Purpose : Calls a subroutine at the location specified by the label.
Format: GOSUB label
Notes: label must be the name of a subroutine program location. When a GOSUB statement is encountered in a script, the script branches to that location. Program control is returned to the next script statement when a RETURN statement is encountered.
Examples:
# Subroutine Demonstration
print "Printing prior
to the subroutine call"
GOSUB prt_sub
print "Printing after
the subroutine call."
pause
exit
# Always locate subroutines
after all other script
# statements. Begin
all subroutines with a program
# label.
*Prt_Sub
# Script execution continues....
print " >>
This printing occurs during the"
print "
>> execution of the subroutine only."
# Until the "RETURN" statement is encountered.
RETURN