Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!oddjob!gargoyle!ihnp4!alberta!myrias!cg From: cg@myrias.UUCP (Chris Gray) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <517@myrias.UUCP> Date: Mon, 13-Jul-87 15:08:48 EDT Article-I.D.: myrias.517 Posted: Mon Jul 13 15:08:48 1987 Date-Received: Wed, 15-Jul-87 01:13:48 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> Organization: Myrias Research, Edmonton Lines: 27 On the subject of 'while' loops, Doug Gwyn (gwyn@brl.arpa) suggests: > Perhaps an ideal programming language would make this something like: > until Get_Next_Character named `c' indicates No_More_Chars, > Do_Stuff_With `c' Actually, what (to me) is much better, so I've included it in a couple of compilers I've done is: while ch := getNextCharacter(); ch ~= EOF do doStuffWith(ch); od; Actually, in my latest language, I would write: while read(inputChannel; ch) do doStuffWith(ch); od; where 'read' is the usual language construct, but which can return a failure indicator where needed. -- Chris Gray Myrias Research, Edmonton +1 403 432 1616 {seismo!mnetor,ubc-vision,watmath,vax135}!alberta!myrias!cg