From mboxrd@z Thu Jan 1 00:00:00 1970 X-Received: by 2002:a05:620a:1107:b0:778:8eac:460 with SMTP id o7-20020a05620a110700b007788eac0460mr225543qkk.7.1698201176696; Tue, 24 Oct 2023 19:32:56 -0700 (PDT) X-Received: by 2002:a05:6808:148e:b0:3a8:8470:fe6a with SMTP id e14-20020a056808148e00b003a88470fe6amr5167544oiw.6.1698201176459; Tue, 24 Oct 2023 19:32:56 -0700 (PDT) Path: eternal-september.org!news.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Oct 2023 19:32:56 -0700 (PDT) In-Reply-To: <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=110.174.123.6; posting-account=uDLjqAoAAACt8a0xeVi3oCavO0f84_b- NNTP-Posting-Host: 110.174.123.6 References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com> <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to exit from "for t in C when f(t) loop" ? From: "min...@gmail.com" Injection-Date: Wed, 25 Oct 2023 02:32:56 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2236 Xref: news.eternal-september.org comp.lang.ada:65806 List-Id: On Monday, October 23, 2023 at 6:04:30=E2=80=AFPM UTC+11, reinert wrote: > mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:=20 > > Assume the loop:=20 > >=20 > > for t of C loop=20 > > if f(t) then=20 > > do something....=20 > > elsif f(t) > f1 then=20 > > exit;=20 > > end if;=20 > > end loop;=20 > >=20 > > I would like to simplify this construct (somehow) like this:=20 > >=20 > > for t of C when f(t) loop=20 > > do something....=20 > > end loop;=20 > >=20 > > However, this is not computationally effective, since t in this case ru= ns through the whole C.=20 > > Any ideas for a compromise?=20 > >=20 > > 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=20 t :=3D C'first; loop do something... exit when Condition; t :=3D t + 1; end loop; The conditon is just a boolean expression. It can be as simple or as compli= cated as one desires.