
Syntax
ON N GOSUB SubName|SubLabel {, SubName|SubLabel}
Remarks
"N" is a numeric expression that is rounded to an integer. The value of N determines
which subroutine is to be called. If the value of N is 0, or greater than the number of
routines listed, the interpreter will continue with the next executable statement.
"SubName" is the name of a subroutine.
"SubLabel" is the line label of a subroutine.
Example
PRINT "Input a number (1-9):"
INPUT Num%
CLS
ON Num% GOSUB 100, 100, 100, 200, 200, 300, 400, 400, 400
...
100
PRINT "Number 1-3 is input."
RETURN
200
PRINT "Number 4-5 is input."
RETURN
300
PRINT "6 is input."
RETURN
400
PRINT "Number 7-9 is input."
RETURN
...
ON ... GOTO ...
Purpose
To branch to one of several specified Line Labels depending on the value of an
expression.
Syntax
ON N GOTO LineLabel {, LineLabel}
Remarks
"N" is a numeric expression which is rounded to an integer. The value of N
determines which line label in the list will be used for branching. If the value N is 0,
or greater than the number of line labels listed, the interpreter will continue with the
next executable statement.
"LineLabel" is the string label of a program line.
Kommentare zu diesen Handbüchern