Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!cornell!uw-beaver!uw-june!pardo From: pardo@june.cs.washington.edu (David Keppel) Newsgroups: comp.lang.misc Subject: Structured loops (WAS:Re: Turing programming language.) Keywords: programming language Message-ID: <7053@june.cs.washington.edu> Date: 24 Jan 89 21:56:11 GMT References: <11@euteal.UUCP> <89Jan20.111000est.4328@turing.toronto.edu> <12@euteal.UUCP> Reply-To: pardo@cs.washington.edu (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 46 >>[Ongoing discussion of Turing loop structure] In article <12@euteal.UUCP> mart@euteal.UUCP (Mart van Stiphout) writes: >[ C's "do", "for", "while" vs. "loop" structring ] >[What about the following 1.5 loop?] > while ( i = read() ) { ... code .... } The above C fragment lets you put only restricted kinds of code inside the `while' condition (a 1.25 loop?). There is a more general construct that I've not seen in any existing programming languages, although (a) doubtless it exists and (b) the idea is easily a decade old (ok, probably 30, but I *know* at least 10) Substitute your favorite C/Pascal/Lisp/Smalltalk syntax. In meta-Algol: do ... while boolean ... od; The conventional "while" loop looks like: do while (condition) ... od; The "repeat until" looks like: do ... while (condition) od; A single-exit 1.5 loop (most of my 1.5 loops are single exit) looks like: do ... while (condition) ... od; The multi-exit 1.5 loop is still less structured. ;-D on ( Do ... while ... crazy ... ) Pardo -- pardo@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo