GoSub

Function:

 This command calls a subroutine from within a script.

Syntax:

 GoSub <label>

Example:

 GoSub Sample

 ; Lines of script

 :Sample

  ;Subroutine functions

 Return

Notes:

This command functions in much the same way as a Goto command. The difference is that Goto is usually used to jump over parts of the main code, whereas Gosub is used to do something in between since the subroutine always returns to where it left the main code. Subroutines cannot be nested, i.e. a subroutine cannot be called from another subroutine. See Example Script 59 for example usage.