Skip to content

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.

RETURN

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.

00010 GOSUB 00500
00011 PRINT X
. . .
00500 LET X = X**Y
00501 RETURN

Program execution branches to the subroutine at statement 00500 and, when completed, the RETURN directive transfers execution back to statement 11.

[ON] GOSUB directive

From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF