CONTENTS | PREV | NEXT
5F. for-statement (FOR)
-----------------------
FOR, TO, STEP, DO, ENDFOR

syntax:		FOR <var> := <exp> TO <exp> STEP <step> DO <statement>
or:		FOR <var> := <exp> TO <exp> STEP <step>
                  <statements>
		ENDFOR

builds a for-block, note the two general forms. <step> may be
any positive or negative constant, excluding 0, and is optional. Example:

FOR a:=1 TO 10 DO WriteF('\d\n',a)

The body of FOR may contain EXIT statements with the following syntax:

EXIT <boolexp>

Which allows you to exit the loop if boolexp is true.