| Directives |
|
| Format | GOSUB
stmtref Where: |
||
| stmtref | Program line number or statement label to which to transfer control. | ||
| Description | Use
GOSUB to access a subroutine embedded in
your current program. The current location in the program
is saved on a stack and control is passed to the
statement number or label you specify (or if no statement
exists with the number specified, to the next higher
statement). ProvideX continues execution from there until
a RETURN is executed. Then it returns
control to the position saved on the stack If you want to exit from a GOSUB subroutine without returning to the calling point, you can use the EXITTO directive to remove the return point from the stack. You must use either a RETURN or an EXITTO directive to terminate each GOSUB subroutine. Do not place a RETURN directive inside a FOR/NEXT loop or a WHILE/WEND loop. There is no limit (apart from memory space) to the number of GOSUB/RETURN entries that you can have on the stack. |
||
| *Note* | The BEGIN, CLEAR, RESET, STOP, and END directives reset all entries in the | ||
| GOSUB/RETURN stack. | |||
| See Also | EXITTO
End Loop, Transfer Control, RETURN Return From a Subroutine. Structured Error handling using ON ERR - an +PxPlus Exclusive |
||
| Examples |
|
||