Programming instructions

36
Intermec Fingerprint 6.13 – Programmer's Guide
5. FINGERPRINT PROGRAMMING, cont'd.
8. Conditional Branching
Continued!
As the name implies, conditional branching means that the program
execution branches to a certain line or subroutine when a specified
condition is fulfilled. The following instructions are used for
conditional branching:
IF...THEN GOTO...ELSE
If a specified condition is TRUE, the program branches to a certain
line, but if the condition is FALSE, something else will be done.
Example:
10 INPUT "Enter a value: ",A%
20 INPUT "Enter another value: ",B%
30 IF A%=B% THEN GOTO 100 ELSE PRINT "NOT EQUAL"
40 END
100 PRINT "EQUAL"
110 GOTO 40
RUN
ON...GOSUB
Depending on the value of a numeric expression, the execution will
branch to one of several subroutines. If the value is 1, the program
will branch to the first subroutine in the instruction, if the value is
2 it will branch to the second subroutine and so on.
Example:
10 INPUT "Press key 1, 2, or 3 on host: ", A%
20 ON A% GOSUB 1000, 2000, 3000
30 END
1000 PRINT "You have pressed key 1": RETURN
2000 PRINT "You have pressed key 2": RETURN
3000 PRINT "You have pressed key 3": RETURN
RUN
ON...GOTO
This instruction is similar to ON...GOSUB, but the program will
branch to specified lines instead of subroutines. This implies that
you cannot use RETURN statements to go back to the main
program.
Example:
10 INPUT "Press key 1, 2, or 3 on host: ", A%
20 ON A% GOTO 1000, 2000, 3000
30 END
1000 PRINT "You have pressed key 1": GOTO 30
2000 PRINT "You have pressed key 2": GOTO 30
3000 PRINT "You have pressed key 3": GOTO 30
RUN
Relational Operators
Also see:
Chapter 4.9