🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #883

Re: do...while vs. repeat...until (was: Errors aren't that simple)

#883
From: Flint Pellett
Date: Fri, 16 Mar 1990 15:12
33 lines
2101 bytes
I have always felt that the re-use of the "while" keyword for both the
top and the bottom of a loop was a language flaw, as is reusing "break"
for both exiting cases and loops.  When you are looking at a 70-line
loop (so you can't see the whole loop on one screen) often the only
clue you have whether that "while" you are looking at is the bottom or
the top of a loop is whether or not a } preceeds the while on the same
line, and some people's coding styles don't guarantee that.  (I keep
it straight by having a while that ends a loop always have the } right
before it.) 

I have to admit to liking the construct below for loops the best: (On
any of these leaving the (condition) out is the same as if the
condition were true, except for endloop, where the default is an
unconditional branch back to the loop.) 

loop (condition)	/* keep looping as long as the condition is met */
...
outloop (condition)	/* 'break' if the condition is met */
...
reloop (condition)	/* 'continue' back at the "loop" if condition met */
...
endloop (condition)	/* exit the loop now if the condition is met */

The four keywords above make it very clear what you are doing at each step,
even when you cannot look at the entire loop at once.  (You never have to
wonder if that 'break' goes with a 'case' or with a 'while' either in
those cases where only the break is on your screen.)
-- 
Flint Pellett, Global Information Systems Technology, Inc.
1800 Woodfield Drive, Savoy, IL  61874     (217) 352-1165
INTERNET: flint%gistdev@uxc.cso.uiuc.edu
UUCP:     uunet!gistdev!flint
Technical Details
Message-ID: <893@gistdev.gist.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!gistdev!flint
References: <8192@hubcap.clemson.edu> <17000003@hpcvra.CV.HP.COM> <Mar.7.10.43.42.1990.17402@paul.rutgers.edu> <5819.25f7a840@vax1.tcd.ie> <16188@haddock.ima.isc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!gistdev!flint
From: flint@gistdev.gist.com (Flint Pellett)
Newsgroups: comp.lang.misc
Subject: Re: do...while vs. repeat...until (was: Errors aren't that simple)
Message-ID: <893@gistdev.gist.com>
Date: 16 Mar 90 15:12:27 GMT
References: <8192@hubcap.clemson.edu> <17000003@hpcvra.CV.HP.COM> <Mar.7.10.43.42.1990.17402@paul.rutgers.edu> <5819.25f7a840@vax1.tcd.ie> <16188@haddock.ima.isc.com>
Organization: Global Information Systems Technology Inc., Savoy, IL
Lines: 33