RETURN
Terminate Subroutine
This directive terminates a subroutine and returns program execution to the statement following the originating GOSUB or ON GOSUB directive or the point of interruption where the Escape key was pressed.
Syntax
Section titled “Syntax”RETURNRemarks
Section titled “Remarks”Nested [ON] GOSUB directives require a separate RETURN for each [ON] GOSUB.
A RETURN directive that is executed with no active [ON] GOSUB directive or Escape key condition produces an error.
An active [ON] GOSUB or Escape key condition is terminated by RETURN. These conditions are also terminated by the EXITTO directive, but the return point is lost with EXITTO.
This directive can be used in program mode or with the EXECUTE directive only; a statement number must precede the directive.
The program line number or label position of the RETURN directive has no relationship to its associated [ON] GOSUB.
Examples
Section titled “Examples”00010 GOSUB 0050000011 PRINT X . . .00500 LET X = X**Y00501 RETURNProgram execution branches to the subroutine at statement 00500 and, when completed, the RETURN directive transfers execution back to statement 11.
See also
Section titled “See also”[ON] GOSUB directive
From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF