qb45advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
ON...GOSUB and ON...GOTO Statement Details
◄QuickSCREEN► ◄Details► ◄Example► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
ON...GOSUB and ON...GOTO Statement Details
Syntax 1
ON expression GOSUB {line-number-list | line-label-list}
Syntax 2
GOTO {line-number-list | line-label-list }
The expression argument can be any numeric expression (expression is
rounded to an integer before the ON...GOSUB or ON...GOTO is evaluated).
The line-number-list or line-label-list consists of a list of line numbers
or line labels, separated by commas. The value of expression determines
which line the program branches to. For example, if the value is 3, the
third line specified in the list is the destination of the branch.
The value of expression should be greater than or equal to 1 and less
than or equal to the number of items in the list. If the value falls
outside this range, one of the following results occurs:
Value Result
Number equal to 0 or greater Control drops to the next BASIC
than number of items in list statement.
Negative number or An error message appears that reads
number greater than 255 "Illegal function call."
You may mix line numbers and labels in the same list.
Note: ON...GOTO statement accepts a maximum of 60 line labels or line
numbers. The SELECT CASE statement provides a more powerful,
convenient, and flexible way to do multiple branches.