GLBasic User Manual

Main sections

GOTO

mark:
...
GOTO mark



Jumps to the jumpmark 'mark' within your code. A jumpmark is a line containing a word followed by a colon.
You cannot jump from within a subroutine to a jumpmark in either a different subroutine or within the main program. The reverse also applies (you cannot jump from the main program to a jumpmark within a subroutine).
Unlike a GOSUB, a GOTO does not remember where your code jumped from.

Sample:
 
PRINT "This appears", 100, 100
GOTO shortcut
PRINT "This won't appear", 100, 150 // This won't appear
shortcut:
SHOWSCREEN
MOUSEWAIT


Output:
This appears

See also...