statement/GOSUB statement/GOSUB NAME GOSUB -- Calls a subroutine ABBREVIATION go <shift> S SYNOPSIS GOSUB <line> FUNCTION This statement is like the GOTO statement, exept that your computer remembers where it came from. When a line with a RETURN statement is encountered, the program jumps back to the statement immediately following the GOSUB. The target of a GOSUB statement is called a subroutine. A subroutine is useful if there is a routine in your program that can be used by several different portions of the program. Instead of duplicating the section of program over and over, you can set it up as a subroutine, and GOSUB to it from the different parts of the program INPUTS <line> - line number where subroutine begins RESULT Program execution continues in a given subroutine (<line>) until RETURN statement is encountered. EXAMPLES 20 GOSUB 800 ... 800 PRINT "HI THERE":RETURN Line 20 means: go to the subroutine beginning at line 800 and execute it. NOTES None BUGS None SEE ALSO GOTO RETURN