Programming instructions
Intermec Fingerprint v7.61 – Programmer’s Reference Manual Ed. 7 179
Chapter 2 Program Instructions
ON GOTO
Field of Application
Statement for conditional branching to one of several lines.
Syntax ON<nexp>GOTO<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 GOSUB statement. The
nu1meric 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 lines, the
statement will be ignored.
The value of the numeric expression determines which of the lines the program
should branch to. For example, if the the value of the numeric expression is 2,
the program will branch to the second line 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% GOTO 1000,2000,3000
30 END
1000 PRINT "You have pressed key 1"
1010 GOTO 30
2000 PRINT "You have pressed key 2"
2010 GOTO 30
3000 PRINT "You have pressed key 3"
3010 GOTO 30
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
YYY: END
QQQ: PRINT "You have pressed key 1"
GOTO YYY
WWW: PRINT "You have pressed key 2"
GOTO YYY
ZZZ: PRINT "You have pressed key 3"
GOTO YYY
IMMEDIATE ON