From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7596cfba54ad3207 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-28 04:44:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.socal.rr.com!newsfeed.news2me.com!west.cox.net!cox.net!p01!news2.central.cox.net.POSTED!53ab2750!not-for-mail Message-ID: <3D1C4BC9.5010504@telepath.com> From: Ted Dennison User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Trivial Ada question References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 28 Jun 2002 11:44:12 GMT NNTP-Posting-Host: 68.12.51.201 X-Complaints-To: abuse@cox.net X-Trace: news2.central.cox.net 1025264652 68.12.51.201 (Fri, 28 Jun 2002 07:44:12 EDT) NNTP-Posting-Date: Fri, 28 Jun 2002 07:44:12 EDT Organization: Cox Communications Xref: archiver1.google.com comp.lang.ada:26764 Date: 2002-06-28T11:44:12+00:00 List-Id: Reinert Korsnes wrote: > Yes, maybe the simplest possible. > The example below is also somehow simple, > but I hoped for some "exit name" solution > which I have not yet noticed :-) > > reinert > > All_OK := 1; (0 changed to 1) > for I in A'Range loop > if not some condition (I) then > All_OK := 0; (1 changed to 0) > exit; > end if; > end loop; > N := N + All_OK; Hmmmm. How about: function All_Some_Condition (A : Some_Array; N : Natural) return Natural is begin for I in A'range loop if not some condition A(I) then return N; end loop; end loop; return N + 1; end All_Some_Condition; (Warning: Not compiled. A'range may need to be A'first..A'last, I always get those mixed up)