Skip to content

On...GoSub ​

Branches to one of several specified subroutine lines, depending on the value of an expression.

The On...GoSub statement is documented together with On...GoTo on the On...GoTo, On...GoSub page.

Syntax:

On expression GoSub destinationlist

When expression evaluates to n, control transfers to the n-th label in destinationlist, just as if a GoSub had been executed against that label. A subsequent Return within the called subroutine resumes execution at the statement following the On...GoSub. See On...GoTo, On...GoSub for the full description of out-of-range values, the 0-255 constraint on expression, and worked examples.

See Also ​

twinBASIC and LOGO copyright of "WaynePhillipsEA" author