intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 4.14 DESCRIPTION OF STATEMENTS STATEMENTS: ON [expr] GOTO[ln num], [ln num], . . . [ln num] ON [expr] GOSUB[ln num], [ln num], . . . [ln num] MODE: RUN TYPE: CONTROL The value of the expression following the ON statement is the number in the line list that control will be transferred to. EXAMPLE: 10 ON Q GOTO 100,200,300 If Q was equal to 0, control would be transferred to line number 100. If Q was equal to 1, control would be transferred to line number 200. If Q was equal to 2, GOTO line 300, etc. All comments that apply to GOTO and GOSUB apply to the ON STATEMENT. If Q is less than ZERO a BAD ARGUMENT ERROR will be generated.

If Q is greater than the line number list following the GOTO or GOSUB STATEMENT, a BAD SYNTAX ERROR will be generated. The ON STATEMENT provides "conditional branching" options within the constructs of an MCS BASIC-52 program. - 44 -