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.
# Subroutine Demonstration
print "Printing prior
to the subroutine call"
print "Printing after the subroutine call."
# Always locate subroutines
after all other script
# statements. Begin all subroutines with a program
# Script execution continues....
print " >>
This printing occurs during the"
print " >> execution of the subroutine only."
# Until the "RETURN" statement is encountered.
See Also: RETURN LABEL