Programmer Guide/Command Reference/GOSUBX

From STX Wiki
< Programmer Guide‎ | Command Reference
Revision as of 08:49, 16 August 2019 by Jw (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
GOSUBX subrlabel [arguments]

Like the GOSUB statement, GOSUBX will call the local subroutine starting at the subrlabel label, and mandatorily ending with an appropriate EXIT statement. Note that, unlike the plain GOSUB, GOSUBX will not create a new local varible space, instead the subroutine use in the local variable space of the caller, meaning that any changes to local variables done in the subroutine will also be visible to the caller.

For this reason, the GOSUBX statement can be a useful tool if numerous arguments and data need to be passed or also for other reasons, but it should be used with care, because changing the variables of the callers may be done as easily unintentionally.

See also: GOTO, DISPATCH, MACRO

Navigation menu

Personal tools