Programming instructions

Intermec Fingerprint v7.61 Programmers Reference Manual Ed. 7178
Chapter 2 Program Instructions
ON GOSUB
Field of Application
Statement for conditional branching to one of several subroutines.
Syntax ON<nexp>GOSUB<ncon>|<line label>[,<ncon>|<line label>...]
<nexp> is a numeric expression that determines which line the
program should branch to.
<ncon>/<line label> is the number or label of the line, or list of lines, to which
the program should branch.
Remarks
This statement is closely related to the ON GOTO statement. The
numeric expression may result in any positive value. The expression
is truncated to an integer value before the statement is executed. If the
resulting value is negative, 0, or larger than the number of subroutines,
the statement will be ignored.
The value of the numeric expression determines which of the subroutines
the program should branch to. For example, if the the value of the
numeric expression is 2, the program will branch to the second subroutine
in the list.
Examples
In this example, different texts will be printed on the screen depending on
which of the keys 1-3 you press on the keyboard of the host.
10 INPUT "PRESS KEY 1-3 ", A%
20 ON A% GOSUB 1000,2000,3000
30 END
1000 PRINT "You have pressed key 1"
1010 RETURN
2000 PRINT "You have pressed key 2"
2010 RETURN
3000 PRINT "You have pressed key 3"
3010 RETURN
The same example written without line numbers would look like this:
IMMEDIATE OFF
INPUT "PRESS KEY 1-3 ", A%
ON A% GOSUB QQQ,WWW,ZZZ
END
QQQ: PRINT "You have pressed key 1"
RETURN
WWW: PRINT "You have pressed key 2"
RETURN
ZZZ: PRINT "You have pressed key 3"
RETURN
IMMEDIATE ON