Directs execution to continue at a BASIC subroutine.
GOSUB
location
location is either a line number or label at which execution should continue.
USe a RETURN statement to end a subroutine.
A subroutine may be called any number of times in a program, and a subroutine may be called from within another subroutine. Such nesting of subroutines is limited only by available memory.
Subroutines can appear anywhere in the program, but must be readily distinguishable from the main program.
To prevent inadvertent entry, precede the subroutine by a STOP, END, or GOTO statement to direct program control around the subroutine.
GOSUB
is the older method of accessing subroutines. Most new programs use QBasic SUB and CALL statements.
GOSUB Test
END
Test:
PRINT "In subroutine Test"
RETURN