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,8002154d2966e1a1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-05 09:29:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Local vs global variables in ADA Date: 05 Nov 2002 12:28:58 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <5Ldx9.3695$151.38236@weber.videotron.net> <3DC5D1B7.1060707@acm.org> <3DC6DD54.10200@acm.org> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1036517999 7279 128.183.235.92 (5 Nov 2002 17:39:59 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 5 Nov 2002 17:39:59 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:30388 Date: 2002-11-05T17:39:59+00:00 List-Id: Fraser Wilson writes: > ... Isn't there a preference hierarchy from for loop to while > loop to loop? I.e. use a for loop whenever possible, failing that a > while loop, and as a last resort a loop with an exit. OK, and as a > last last resort use a goto. In my style guide, I use a for loop _only_ if the loop will _always_ be executed exactly as indicated in the "for" part. No other loop exits allowed. Otherwise, I use an "exit when" loop. Never use a "while" loop. Mostly because "exit when" is much clearer, partly because I've used other languages that had slightly different definitions of "while", and I can't keep them straight. -- -- Stephe