# On...GoSub
{: .no_toc }

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**](/tB/Core/On-GoTo.md) 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**](/tB/Core/GoSub-Return.md) had been executed against that label. A subsequent [**Return**](/tB/Core/Return.md) within the called subroutine resumes execution at the statement following the **On...GoSub**. See [**On...GoTo, On...GoSub**](/tB/Core/On-GoTo.md) for the full description of out-of-range values, the 0-255 constraint on *expression*, and worked examples.

### See Also

- [**On...GoTo** statement](/tB/Core/On-GoTo.md)
- [**GoSub...Return** statement](/tB/Core/GoSub-Return.md)
- [**Select Case** statement](/tB/Core/Select-Case.md)
