Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!mcsun!ukc!cam-cl!cet1 From: cet1@cl.cam.ac.uk (C.E. Thompson) Newsgroups: comp.lang.misc Subject: Re: do...while vs. repeat...until (was: Errors aren't that simple) Message-ID: <1808@gannet.cl.cam.ac.uk> Date: 16 Mar 90 15:42:35 GMT References: <8192@hubcap.clemson.edu> <17000003@hpcvra.CV.HP.COM> <5819.25f7a840@vax1.tcd.ie> <16188@haddock.ima.isc.com> Sender: news@cl.cam.ac.uk Reply-To: cet1@cl.cam.ac.uk (C.E. Thompson) Organization: U of Cambridge Comp Lab, UK Lines: 32 In article <16188@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes: >In article <5819.25f7a840@vax1.tcd.ie> cbuckley@vax1.tcd.ie writes: >>In article , emuleomo@paul.rutgers.edu (Emuleomo) writes: >>> The other less serious flaw in C is the do...while contruct. >>> I kind of prefer PASCAL's repeat....until construct myself. >> >>How can this be a flaw? The two constructs are identical except for the fact >>that the condition is reversed... > >That's enough to make it a (minor) flaw. Judging from my own personal >experience, it is more natural for a test-at-top loop to specify the condition >for continuing (while), but for a test-at-bottom loop to specify the condition >for terminating (until). I don't know if there's been a study on this; in >fact, I'm not entirely sure how to formalize the concept. Time for another BCPL-was(is)-better-than-C plug. BCPL has WHILE expression DO command UNTIL expression DO command command REPEATWHILE expression command REPEATUNTIL expression and of course command REPEAT /* for ever */ But you probably wanted to use some of those reserved words as variable names, right? :-) Chris Thompson JANET: cet1@uk.ac.cam.phx Internet: cet1%phx.cam.ac.uk@nsfnet-relay.ac.uk