Main Help → GENerel Reference → GoSub Command
The GoSub command is used to call subroutines. The calling format is
GoSub subname,#1,#2,...#n
where
subname is the name of the subroutine. The subroutines must be defined at the beginning of the commands. Note that subname can be replaced by an expression that evaluates to a valid subroutine name.#1,#2,...,#n are any expressions. The total number of expressions must match the number of arguments in the subroutine definition or at least the number of required arguments if the subroutine allows optional arguments. The variables in the subroutine definition will be set equal to the values passed in the GoSub command.For readability when compared to other languages, subroutines can be called by enclosing all arguments in parentheses and the GoSub command is optional. All these variations are equivalent:
GoSub subname,#1,#2,...#n GoSub subname(#1,#2,...#n) subname #1,#2,...#n subname(#1,#2,...#n)
GoSub, the name of the subroutine must not match any built-in command.