Commands for looping structures, 3 commands for looping structures – Argox PA-20 Basic Programming Manual User Manual
Page 22

PT-Basic Programming Manual Ver. 1.00
21/143
3.3 Commands for looping structures
Purpose: To provide an alternative exit for looping structures,such as
FOR…NEXT and WHILE…WEND statements.
Syntax: EXIT
Example: WHILE 1
IF INKEY$=CHR$(27) THEN „if press ESC key
then quit
EXIT
END IF
WEND
PRINT "EXIT..."
Description: EXIT can appear anywhere within the loop statement.
Purpose: To repeat the execution of a block of statements for a
specified number of times.
Syntax: FOR N% = startvalue TO endvalue [STEP step]
[Statement Block]
NEXT
Example: FOR N% = 1 TO 6 STEP 1
PRINT "FOR NEXT",N%
NEXT
Description: 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.