End of Subroutine
RETURN
Terminates the processing of a subroutine started by GOSUB.
Subroutines may never be achieved by the normal program sequence, or be started by GOTO. Executed in the main program, RETURN leads to a runtime error. Are subroutines at the end of a program, then the main program should be terminated before with END. If subroutines stand before the main program, then a branch instruction is needed to go around:
GOTO MAIN : ! Goto main program
! a subroutine follows
$SUB
PRINT "Subroutine"
RETURN
! the main program
$MAIN
... |
RETURN is also used with user functions.
- GOSUB - Subroutine reference
- END - End of program execution
|