GoTo Command

Immediately branches to the specified label.

Syntax

GoTo label

where label is defined by the Label command.

Remarks

Other control structures are preferred, but some tasks can only be accomplished using the GoTo command. For example, if a user makes a major error, you can end the adventure using the GoTo MAIN_END command. However, using multiple GoTo commands makes your code hard to trace.

Example

'If the aircraft altitude is greater than 5,000, execution skips over the END statement, executes the PRINT statement, and then checks for altitude equal to 6,000.

IF PLANE_ALT > 5000 THEN

GOTO subAlt_5K

ENDIF

END

subAlt_5K:

PRINT "Altitude is greater than 5,000."

IF PLANE_ALT = 6000 THEN

PRINT "Aircraft altitude equals 6,000."

ENDIF