BASIC FUNCTIONS
SECTION 5. 16
ON .. GOTO
5.16,6 Function ON ••• GOTO ••• allows conditional jumping.
Syntax ON expression GOTO line number 1, line number 2, .... line
number n.
Exauples 10 ON A GOT0100,200,300
20 END
If A=1 then the program will go to line 100
If A=2 then the program will go to line 200
If A=3 then the program will go to line 300
If A:1,3 then the program will go to line 100,
Remarks ON GOTO will cause program execution to jump to a line
number chosen from the list of line numbers positioned
immediately after GOTO, The selection of a particular line
number in this list is determined by the value of
[ expression
l.
VER.V09F
The line numbers may themselves be expressions.
The value of [expression], in the above example A, is
truncated to an integer,
It must be noted that the value is truncated to an integer
and
NOT rounded up, So if the above example A=1,9 then the
program will go to line 100,
If the value of [expression] is zero or greater than the
number of line numbers in the list, then program execution
will continue with the next statement.
In the above example, if A=4, or
if A=O then the program
will automatically go to line 20, and an END will be
executed,
The maximum value of [expres-sion
l allowed is 255,
If the value of [expression] is greater than 255 then a
PAGE 5 - 92