17.08.2013 Views

Contents, cont'd. - Intermec

Contents, cont'd. - Intermec

Contents, cont'd. - Intermec

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ON GOTO<br />

Chapter 2 Program Instructions<br />

Field of Application Statement for conditional branching to one of several lines.<br />

Syntax ON GOTO|[,|...]<br />

is a numeric expression that determines which line the<br />

program should branch to.<br />

/ is the number or label of the line, or list of lines, to which the<br />

program should branch.<br />

Remarks This statement is closely related to the ON GOSUB statement. The numeric<br />

expression may result in any positive value. The expression is truncated to an<br />

integer value before the statement is executed. If the resulting value is<br />

negative, 0, or larger than the number of lines, the statement will be ignored.<br />

The value of the numeric expression determines which of the lines the<br />

program should branch to. For example, if the the value of the numeric<br />

expression is 2, the program will branch to the second line in the list.<br />

Examples In this example, different texts will be printed on the screen depending on<br />

which of the keys 1-3 you press on the keyboard of the host.<br />

10 INPUT "PRESS KEY 1-3 ", A%<br />

20 ON A% GOTO 1000,2000,3000<br />

30 END<br />

1000 PRINT "You have pressed key 1"<br />

1010 GOTO 30<br />

2000 PRINT "You have pressed key 2"<br />

2010 GOTO 30<br />

3000 PRINT "You have pressed key 3"<br />

3010 GOTO 30<br />

The same example written without line numbers would look like this:<br />

IMMEDIATE OFF<br />

INPUT "PRESS KEY 1-3 ", A%<br />

ON A% GOSUB QQQ,WWW,ZZZ<br />

YYY: END<br />

QQQ: PRINT "You have pressed key 1"<br />

GOTO YYY<br />

WWW: PRINT "You have pressed key 2"<br />

GOTO YYY<br />

ZZZ: PRINT "You have pressed key 3"<br />

GOTO YYY<br />

IMMEDIATE ON<br />

<strong>Intermec</strong> Fingerprint 7.2 – Reference Manual Ed. 3 160

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!