Original Author Paul Laughton, 2011
Page 83
De Re BASIC!
...
<statement>
GoTo Loop
GoTo <label>
The next statement that will be executed will be the statement following <label>.
GoTo <index_nexp>, <label>...
A "computed GOTO". The index expression is evaluated, rounded to the nearest integer, and used as an
index into the list of labels. The program jumps to the statement after the indexed label. If the index
does not select any label, the program continues at the statement after the GoTo.
For examples, see GoSub.
GoSub <label> / Return
The next statement that will be executed will be the statement following <label>.
The statements following the line beginning with <label> will continue to be executed until a Return
statement is encountered. Execution will then continue at the statement following the GoSub
statement.
Example:
Message$ = "Have a good day"
GOSUB xPrint
PRINT "Thank you"
<statement>
...
<statement>
END
xPrint:
PRINT Message$
RETURN
This will print:
Have a good day
Thank you
GoSub <index_nexp>, <label>... / Return
A "computed GOSUB". The index expression is evaluated, rounded to the nearest integer, and used as
an index into the list of labels. The program jumps to the statement after the indexed label. When the
next Return instruction executes, the program returns to the statement after this GoSub.
If the index does not select any label, the program continues to the statement after the GoSub. No
subroutine is executed, and no Return statement is expected.
Example: