Labels and the GOTO and GOSUB commands
The GOTO and GOSUB commands enables you to jump to certain positions in your program.
Labels are used to specify what point in the program to continue execution.
GOTO
To use GOTO, place a label somewhere in your program, and then enter.
GOTO
Run the following example program:
PRINT "1"
GOTO TheLabel
PRINT "2"
TheLabel:
PRINT "3"
Output (notice how PRINT "2" is skipped):
(^13)
TIP: TheLabel can be placed on the same line
as PRINT "3"
TheLabel: PRINT "3"
GOSUB
The GOSUB command is the same as GOTO, except when it encounters a RETURN statement, the
program "returns" back to the GOSUB command. In other words, RETURN continues program
execution immediately after the previous GOSUB statement.
PRINT "1"
GOSUB TheLabel
PRINT "2"
END