Branch to one of several
specified labels, depending on the value of a variable.
ON var [GOTO] [GOSUB]
label1 [, label2 ]
Var The numeric variable
This can also be a SFR such as P1.
label1, label2 The labels to jump to depending on the value of var.
Note that the value is zero based. So when var = 0, the first specified
label is jumped/branched.
x = 2 'assign a variable interrupt
ON x GOSUB lbl1,
lbl2,lbl3 'jump to label lbl3
ON x GOTO lbl1,
lbl2 , lbl3
PRINT " lbl3"