comp.lang.ada
 help / color / mirror / Atom feed
* Re: How to exit from "for t in C when f(t) loop" ?
       [not found] ` <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>
@ 2023-10-25  2:32   ` min...@gmail.com
  0 siblings, 0 replies; only message in thread
From: min...@gmail.com @ 2023-10-25  2:32 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-25  2:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
     [not found] ` <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>
2023-10-25  2:32   ` How to exit from "for t in C when f(t) loop" ? min...@gmail.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox