Download manual
Transcript
ON-GOSUB - Flow Control Function Call subroutine beginning at one of several possible line numbers Syntax ON expression GOSUB line number, line number See Also ON GOTO Usage expression selects the beginning line number for a subroutine call. If expression evaluates to zero then execution continues at the program line specified by the first line number in the list. After a RETURN statement is executed in the subroutine, execution resumes with the statement following the ON-GOSUB. If the value of expression is greater than or equal to the number of line numbers in the list, then the BAD SYNTAX error message will be generated. Example 4.64 10 IF (MODEL<0).OR.(MODEL>3) THEN GOSUB 100 20 ON MODEL GOSUB 1000, 2000, 3000, 4000 ... 100 REM Subroutine to enter model number 150 RETURN ... 1000 REM Build array tables for manufacturing MODEL=0 1999 RETURN ... 2000 REM Build array tables for testing MODEL=1 2999 RETURN ... 3000 REM Build array tables for monitoring MODEL=2 3999 RETURN ... 4000 REM Build array tables for building MODEL=3 4999 RETURN ... STATEMENTS