Path: utzoo!utgpu!watserv1!watmath!att!bellcore!rutgers!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p0.f4.n494.z5.fidonet.org!cspw.quagga From: cspw.quagga@p0.f4.n494.z5.fidonet.org (cspw quagga) Newsgroups: comp.lang.modula2 Subject: Re: Why are the loops so awkward? Message-ID: <5759.2677DF35@puddle.fidonet.org> Date: 15 Jun 90 00:07:42 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 5:494/4.0 - Settler City Fido, Grahamstown RSA Lines: 32 There have been a number of suggestions that my awkward problem of processing every element in a string should be coded like this i := 0; WHILE (i < Length(s)) DO process(S[i]); INC(i); END; Although this works nicely, it violates all the ideas that one should distinguish between definite loops (where the number of iterations is known in advance, and a FOR loop is the most appropriate construct), and an indefinite loop where one iterates until or while the conditions have not been fulfilled. So although this loop satifies the problem, imho it is stylistically bad. Pete -- EP Wentworth - Dept. of Computer Science - Rhodes University - Grahamstown. Internet: cspw.quagga@f4.n494.z5.fidonet.org Uninet: cspw@quagga uucp: ..uunet!m2xenix!quagga!cspw -- uucp: uunet!m2xenix!puddle!5!494!4.0!cspw.quagga Internet: cspw.quagga@p0.f4.n494.z5.fidonet.org