Jumps to a specified subroutine in accordance with a specified branching condition.
ON condition GOSUB [ branch [, [ branch
└───┬───┘ destination ] destination ] ]*
Numeric expression
```basic
⎧ destination branch line number ⎫
⎪ └─────────────┬──────────────┘ ⎪
⎪ Line number ⎪
Branch destination: ⎨ ⎬
⎪ # program area number ⎪
⎪ └────────┬────────┘ ⎪
⎩ Single character; 0~9 ⎭
ON A GOSUB 1000, 1100, 1200
10 S1=0: S2=0
20 FOR I=1 TO 100
30 ON (I MOD 2)+1 GOSUB 1000, 1100
40 NEXT I
50 PRINT "S1="; S1
60 PRINT "S2="; S2
70 END
1000 S1=S1+I: RETURN
1100 S2=S2+I: RETURN
S1 calculates sum of even numbers from 1 to 100, S2 calculates sum of odd numbers from 1 to 100.