Jumps to a specified branch destination in accordance with a specified branching condition.
ON condition GOTO [ branch [, [ branch
└───┬───┘ destination ] destination ] ]*
Numeric expression
⎧ destination branch line number ⎫
⎪ └─────────────┬──────────────┘ ⎪
⎪ Line number ⎪
Branch destination: ⎨ ⎬
⎪ # program area number ⎪
⎪ └────────┬────────┘ ⎪
⎩ Single character; 0~9 ⎭
ON A GOTO 100, 200, 300
10 INPUT "1 OR 2"; A
20 ON A GOTO 40, 50
30 END
40 PRINT "ONE" : END
50 PRINT "TWO"
Execution jumps to line 40 if 1
EXE is entered or to line 50 is 2
EXE is entered.
Otherwise, execution terminates at line 30.