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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no 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 14:40:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!teaser.fr!enst!enst.fr!not-for-mail From: "Steven Deller" Newsgroups: comp.lang.ada Subject: RE: Trivial Ada question Date: Fri, 28 Jun 2002 16:38:30 -0500 Organization: Smooth Sailing LLC Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1025300403 21538 137.194.161.2 (28 Jun 2002 21:40:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Fri, 28 Jun 2002 21:40:03 +0000 (UTC) Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal In-Reply-To: <3D1C4BC9.5010504@telepath.com> Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.11 Precedence: bulk X-Reply-To: List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:26773 Date: 2002-06-28T16:38:30-05:00 I'd prefer ... function All_Some_Condition (A : Some_Array) return Boolean is begin for I in A'range loop if not some_condition A(I) then return False ; end if ; end loop ; return True ; end All_Some_Condition ; begin ... if All_Some_Condition(A) then N := N+1 ; end if ; ... That seems to make the intention clearer and the main-line code is easy to read as well. If you have a lot of "conditions" then you could make a generic "All_Are" and instantiate with a function computing the necessary condition. In the case above, you are simply writing an explicit instance, e.g. function All_True ... ... if not A(I) then ... or function All_Less_Than_100 ... ... if not ( A() < 100 ) ... Regards, Steve