On Saturday, October 28, 2023 at 7:42:10 AM UTC-7, AdaMagica wrote:
> reinert schrieb am Freitag, 27. Oktober 2023 um 16:53:15 UTC+2:
> > I would like an exit possibility somehow like this:
> >
> > for t of C when f(t), but exit when f(t)
> except when Y then skip next -- many more lines saved ;-)
> > loop
> > do something....
> > end loop;
> >
'exit when condition;' is perfectly legal Ada.
It is more problematic that you are executing f(t) twice; that's either wrong if it has side effects, or wasteful if not.
And you are treating f(t) as returning a Boolean and a scalar!
for t of C loop
declare
A : foo renames f(t);
begin
exit when A; -- Boolean
exit when A >= f1; -- scalar
do something;
end;
end loop;