ON

 
Purpose:     Selectable GOTO or GOSUB.
 
Format:     ON n GOTO line [, line...]
 
ON n GOSUB line [, line...]
 
Description:     n is an expression rounded to an integer line is a line number in the program
 
 
The value of n determines which line number in the list the program uses for branching. For ex am ple, if n is 3, the third line number in the list is the point to which the program branches.
If the value of n is illegal for the given list, no branch occurs.
 
Example:
10
VAR1 = AVG ( IN1 , IN2 , IN3 , IN4 ) - 20
 
 
 
 
 
 
20
ON VAR1 GOSUB 100 , 200 , 300 , 400 , 500
 
 
 
 
 
30 END
 
 
 
 
 
 
100
REM THE AVERAGE IS 21 : RETURN
 
 
 
 
 
200
REM THE AVERAGE IS 22 : RETURN
 
 
 
 
 
300
REM THE AVERAGE IS 23 : RETURN
 
 
 
 
 
400
REM THE AVERAGE IS 24 : RETURN
 
 
 
 
 
500
REM THE AVERAGE IS 25 : RETURN