Path: utzoo!utgpu!watmath!att!dptg!rutgers!mailrus!ncar!ico!ism780c!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: What I'd really like to see in an if-statement... Message-ID: <14224@haddock.ima.isc.com> Date: 8 Aug 89 01:47:19 GMT References: <5024@alvin.mcnc.org> <1300@atanasoff.cs.iastate.edu> <456@helios.prosys.se> <14521@bfmny0.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 16 Btw, one of my own pet ideas for "D" is the same notation in a loop construct: for (lo <= var < hi) ... which would mean the same thing as C's for (var = lo; var < hi; ++var) ... except that hi would be evaluated only once, and it would be illegal to change the value of var within the loop. (I.e., it would be your standard for-loop as in BASIC/FORTRAN/PASCAL.) All eight sensible combinations of relational operators would be allowed. (The construct for (hi > var >= lo) ... would step through the same values via a decrementing loop.) The only other proposal I've seen for such a feature uses notation like for (var in [lo, hi)) ... but the syntax for the half-open interval is ugly. (And "[lo, hi[" is worse.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint