gosub

Syntax

gosub subroutineLabel

Description

This command will jump to the specified label in the program. Unlike the goto command, you can use the return command to return to the program location of the last jump performed. In order to use the gosub command you must create a subroutine in your program that terminates with the return command. To create a subroutine you must write a label in your program followed by a sequence of commands. The label can be made up from any combination of alphabetic characters, but you must end the declaration of the label using a colon(:). You only need to use a colon when you are declaring the label, and should not be used when calling the label from a gosub command.

Example

print ( "start" )
gosub _subroutine
print ( "end" )
end

_subroutine: print ( "inside subroutine" ) return