on...goto Statement

The on...goto statement transfers control to the line within the FlashBASIC or BASIC program that begins with the specified statement label, according to the positional value of the expression referenced by exp. The syntax can also be specified as on...go to...(allowing a space between go and to).

Syntax

on exp goto statement.label{,

statement.label...}

 

on exp goto statement.label,...,

statement.label,

statement.label

Description

The on...goto is identical to the on...gosub, except there is no return required.

NOTE

If the exp evaluates to a number less than 1, or to a number greater than the number of statement labels, then control passes to the next executable statement following the on...goto.

Example(s)

This is an indexed branch in the single-line format.

on response goto 100,200,300,400,500

This is an indexed branch in multiline format.

on response goto 100,200,300,

400,500,600,

700,800,900

See Also

goto Statement, on...gosub Statement, Statement Labels, Statements and Functions, u01a2 User Exit