
Example
PRINT "Input a number (1-9):"
INPUT Num%
CLS
ON Num% GOTO 100, 100, 200, 200, 300, 400, 400, 400
...
100
PRINT "Number 1-3 is input."
GOTO 500
200
PRINT "Number 4-5 is input."
GOTO 500
300
PRINT "6 is input."
GOTO 500
400
PRINT "Number 7-9 is input."
500
...
5.3 Commands for Looping Structures
Looping structures repeat a block of statements, either for a specified number of times or
until a certain condition is matched. In BASIC, two kinds of looping structures,
FOR...NEXT and WHILE...WEND can be used. Command EXIT can be used as an
alternative to exit from both FOR...NEXT and WHILE...WEND loops.
Both FOR...NEXT and WHILE...WEND statements can be nested up to 10 levels.
EXIT
Purpose
To provide an alternative exit for looping structures, such as FOR...NEXT and
WHILE...WEND statements.
Syntax
EXIT
Remarks
EXIT can appear anywhere within the loop statement.
Comentarios a estos manuales