# GOSUB

Updated: 11/30/2021, 7:00:45 PM
Created: 11/30/2021, 7:00:45 PM
Last Updated By: Jake Tuttle
Read Time: 1 minute(s)

Tags: program profiling

# Description

Transfer execution of the script to a specified label, but as a subroutine call. Program execution will continue with the next line after 'gosub' after the subroutine completes execution, usually with a RETURN statement.

gosub label
1

where label is the label to which execution should transfer.

An example of use may be as:

gosub loadprog
if exitcode ne 0 then exit exitcode
# Any other code
exit 0
#
loadprog: progname = "TESTER " : $VARNAME : " " : portno
portno = portno + 1
program loadprog
exitcode = $?
Return
1
2
3
4
5
6
7
8
9
10

Back to jKeyAuto