| ON ... GOSUB | Index Level | ONERR |
| Syntax |
ON index.expression GOTO statement.label{, statement.label...}
-or- ON index.expression GOTO statement.label,..., statement.label, statement.label |
| Category | BASIC |
| Type | Statement |
| Description |
transfers control to the line within the FlashBASIC program which begins with the specified statement label, according to the positional value of the index expression referenced by "index.expression". The syntax also allows being specified as "on ... go to ..." (it allows a space between "go" and "to").
The "on ... goto" is identical to the "on ... gosub", except there is no "return" required. |
| Options | |
| See Also | statements & functions GOTO statement labels ON ... GOSUB u01bc u01a2 |
| Example |
on response goto 100,200,300,400,500
This is an indexed branch in the single-line format. on response goto 100,200,300, 400,500,600, 700,800,900 This is an indexed branch in multi-line format. |
| Warnings |
If the "index.expression" evaluates to a number less than one, or to a number greater than the number of statement labels, then control passes to the next executable statement following the "on ... goto".
The multi-line form is NOT supported in R83. |
| Compatibility | D3 7.0 AP R83 |
| ON ... GOSUB | Index Level | ONERR |