52
ON GOSUB
PURPOSE
: Jumps to a specified subroutine in accordance with a specified
branching condition.
FORMAT
:
branch destination line number
Line number
ON
Condition
GOSUB
[
# program area number
]
Numeric expression
Single character; 0-9
*Label
Label name
branch destination line number
Line number
[ , [
# program area number
] ]*
Single character; 0-9
*Label
Label name
EXAMPLE
: ON A GOSUB 1000, 1100, 1200
PARAMETERS
:
1. Branch condition: Numeric expression truncated to an integer
2. Branch destination line number: integer in the range of 1
≤
line number
≤
65535
3. Program area number: single character, 0-9
4. Label: Name of a label in the program.
EXPLANATION
:
1. The GOSUB statement is executed in accordance with the value of the
expression used for the branch condition. For example, execution jumps to the
first branch destination when the value is 1, to the second destination when
the value is 2 etc.
2. Program execution does not branch and execution proceeds to the next
statement when the value of the condition is less than 1, or if a branch
destination corresponding to the value does not exist.
3. Up to 99 branch destinations may be specified.
SEE
: RETURN
P
0