Radio Shack TRS-80 PC-3 Owner's Manual page 150

Table of Contents

Advertisement

1 ON expression GOSUB expression list
Where: expression list
is:
expression
or:
expression, expression list
Abbreviations: 0., GOS., GOSU.
See also: GOSUB, GOTO, ON ... GOTO
Purpose
The ON ... GOSUB verb is used to execute one of a set of subroutines, depending on the value of a control expression.
Use
When the ON ... GOSUB verb is executed, the expression between ON and GOSUB is evaluated and reduced to an integer. If the
value of the integer is 1, the first sUbroutine in the list is executed as in a normal GOSUB. If the expression is 2, the second
subroutine in the list is executed, and so forth. After the RETURN from the subroutine, execution proceeds with the statement
which follows the ON ... GOSUB.
If the expression is zero, negative, or larger than the number of subroutines provided in the list, no subroutine is executed and
execution proceeds with the next line of the program.
NOTE:
Commas may not be used in the expressions following the GOSUB.
The PC-3 Computer cannot distinguish between
commas in expressions and commas between expressions.
150

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents