BASIC RETURN Statement - fvdhoef/aquarius-plus GitHub Wiki

RETURN

TYPE: BASIC Flow Control Statement

FORMAT: RETURN

Action:

The RETURN statement is used to exit from a subroutine called for by a GOSUB statement. RETURN restarts the rest of your program at the next executable statement following the GOSUB. If you are nesting subroutines, each GOSUB must be paired with at least one RETURN statement. A subroutine can contain any number of RETURN statements, but the first one encountered will exit the subroutine.

EXAMPLES of RETURN Statement:

10 PRINT"THIS IS THE PROGRAM"
20 GOSUB 1000
30 PRINT"PROGRAM CONTINUES"
40 GOSUB 1000
50 PRINT"MORE PROGRAM"
60 END
1000 PRINT"THIS IS THE GOSUB":RETURN