User`s manual
4-8
Control branches from line 100 to the subroutine beginning at line 200. Line
210 instructs Computer to return to the statement immediately following
GOSUB, that is, line 110.
RETURN
Ends a subroutine and returns control to statement immediately following
the most recently executed GOSUB. If RETURN is encountered without
execution of a matching GOSUB, an error will occur. See
GOSUB.
ON
n
GOTO
line number, …, line number
This is a multi-way branching statement that is controlled by a test variable
or expression. The general format for ON
n
GOTO is:
ON
expression
GOTO
1st line number, 2nd line number, …, Kth line number
expression
must be between 0 and 255 inclusive.
When ON … GOTO is executed, first the expression is evaluated and the
integer portion … INT(expression) … is obtained. We'll refer to this integer
portion as J. The Computer counts over to the Jth element in the line-number
list, and then branches to the line number specified by that element. If there
is no Jth element (that is, if J > K or J=0 in the general format above), then
control passes to the next statement in the program.
If the test expression or number is less than zero, or greater than 255, an
error will occur. The line-number list may contain any number of items. For
example,
100 ON MI GOTO 150, 160, 170, 150, 180
says "Evaluate MI. If integer portion of MI equals 1 then go to line 150;
If it equals 2, then go to 160;
If it equals 3, then go to 170;
If it equals 4, then go to 150;
If it equals 5, then go to 180;
If the integer portion of MI doesn't equal any of the
numbers 1 through 5, advance to the next statement
in the program."










