Contents  Index  
──────────────────────────────────────────────────────────────────────────────
Branch to one of several locations, depending on the value of an expression.

ON expression% GOSUB line-list
ON expression% GOTO line-listexpression%    An expression in the range 0 through 255.
    ■ line-list      A set of labels or line numbers. If the value of the
                     expression is 1, the program branches to the first line
                     in the list; if the expression is 2, it branches to the
                     second line, and so on.

    ■ SELECT CASE provides a better way to perform multiple branching.

Example:
    FOR i% = 1 TO 2
        ON i% GOSUB One, Two
    NEXT i%
    END

    One: PRINT "One"
    RETURN
    Two: PRINT "Two"
    RETURN

See Also    ON Keyword    SELECT CASE
──────────────────────────────────────────────────────────────────────────────
 © Copyright Microsoft Corporation, 1987-1992. All rights reserved.
   Converted from qbasic.hlp with DosHelp/HelpConvert