From: "min...@gmail.com" <minghia@gmail.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
Date: Tue, 24 Oct 2023 19:32:56 -0700 (PDT) [thread overview]
Message-ID: <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com> (raw)
In-Reply-To: <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>
On Monday, October 23, 2023 at 6:04:30 PM UTC+11, reinert wrote:
> mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:
> > Assume the loop:
> >
> > for t of C loop
> > if f(t) then
> > do something....
> > elsif f(t) > f1 then
> > exit;
> > end if;
> > end loop;
> >
> > I would like to simplify this construct (somehow) like this:
> >
> > for t of C when f(t) loop
> > do something....
> > end loop;
> >
> > However, this is not computationally effective, since t in this case runs through the whole C.
> > Any ideas for a compromise?
> >
> > reinert
> Just a correction of the subject, it should be: How to exit from "for t *of* C when f(t) loop ? -reinert
Normally one does something
t := C'first;
loop
do something...
exit when Condition;
t := t + 1;
end loop;
The conditon is just a boolean expression. It can be as simple or as complicated as one desires.
parent reply other threads:[~2023-10-25 2:32 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox