Return Statement |
GoSub label ... label Return
label
Use: Required
A subroutine label within a procedure.
Branches back to a calling GoSub statement after executing a subroutine within a procedure.
A subroutine can include an number of Return statements.
Return branches back to the statement immediately following the last executed GoSub statement in the current subroutine.
A GoSub statement and the subroutine it calls must reside within the same procedure.
The Return statement is only included in this book for completeness, should you have to maintain legacy code; otherwise, you shouldn't be writing new code using the GoSub...Return statements, since it tends to create "spaghetti" code that is very difficult to read and to maintain. Code should be rewritten using separate procedures.