To my understanding, the FOR-NEXT structure is a direct outgrowth of the
FORTRAN or PL/I DO structure
FORTRAN: DO 35 I = n1, n2, n3 where ,n3 is optional, default to 1
<statements>
35 CONTINUE (or optionally a statement)
PL/I DO I = n1 TO n2 (BY n3); where BY n3 is optional, default to 1
<statements>
END;
Both which execute as follows:
I = n1
Loop: <statement>
<statements>
I = I + n3
if n3 > 0
then if I >= n2 GO TO Loop
else if i <= n2 GO TO Loop
<next statement>
And I hope I haven't screwed up the syntax, been a long time since either
FORTRAN or PL/I. In either case, you are going to DO something at least
once before you leave the structure. If you didn't want to, you would have
used an IF statement before you started. Note however that PL/I has the DO
WHILE and the DO UNTIL structures as well as the DO group in addition to
the SELECT-CASE structure.
-----------------------------------------------------------------------------
Bryan Bremner Washington State University (509) 335-9074
Facilities Administration Systems & Programming Professional
bremner@... http://www.physplt.wsu.edu/ppweb.html