
PT-Basic Programming Manual Ver. 1.00 21/143
3.3 Commands for looping structures
To provide an alternative exit for looping structures,such as
FOR…NEXT and WHILE…WEND statements.
WHILE 1
IF INKEY$=CHR$(27) THEN „if press ESC key
then quit
EXIT
END IF
WEND
PRINT "EXIT..."
EXIT can appear anywhere within the loop statement.
To repeat the execution of a block of statements for a
specified number of times.
FOR N% = startvalue TO endvalue [STEP step]
[Statement Block]
NEXT
FOR N% = 1 TO 6 STEP 1
PRINT "FOR NEXT",N%
NEXT
N% is an integer variable to be used as loop counter.
Startvalue is a mumeric expression which is the initial value
for the loop counter.
Endvalue is a numeric expression which is the final value for
the loop counter.
Step is a numeric expression to be used as an
increment/decrement of the loop counter. The step is 1 by
default.
If the loop counter ever reaches or beyond the endvalue,the
program execution continues to the statement following the
NEXT statement. The Statement block will be executed again
otherwise.
Kommentare zu diesen Handbüchern