Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!luth!sunic!mcsun!unido!gmdzi!wittig From: wittig@gmdzi.UUCP (Georg Wittig) Newsgroups: comp.lang.c Subject: Re: do...while vs. repeat...until (was: Errors aren't that simple) Keywords: loops,while,repeat Message-ID: <2144@gmdzi.UUCP> Date: 28 Mar 90 09:38:28 GMT References: <16188@haddock.ima.isc.com> <9130009@hpavla.AVO.HP.COM> <1539@amethyst.math.arizona.edu> Organization: GMD - The German National Research Centre for Computer Science Lines: 36 raw@math.arizona.edu (Rich Walters) writes: > loop > { statement } > {while (expr) | until (expr)} > { statement } > repeat >This allows _complete_ freedom in where you check for loop termination. You >can check at the beginnig the end or _anywhere_ in between!!! >I think this is the bestest ever!!!!!! Personally, I prefer that style, too. But alas, there are situations where it is far from optimal. Example for (i=0; i<2700; ++i,++j,--k,m=f(x)) { ... if (condition1) continue; ... if (condition2) continue; ... if (condition14) continue; ... } Try to convert that into the general form. It won't look good and clearly arranged. Apart from that, I must admit that a for statement makes the control of the loop much more clear and compact. -- Georg Wittig GMD-Z1.BI P.O. Box 1240 D-5205 St. Augustin 1 (West Germany) email: wittig@gmdzi.uucp phone: (+49 2241) 14-2294 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Freedom's just another word for nothing left to lose" (Kris Kristofferson)