Intermec PB51 Fingerprint Developer's Guide (old) - Page 33

Using an IF...THEN...[ELSE]...END IF Instruction, About Branching, Branching to Subroutines

Page 33 highlights

Chapter 2 - Understanding Fingerprint Syntax 60 END RUN Another way to compare the two values in the example above is to use three IF...THEN statements: 10 INPUT "Enter first value ", A% 20 INPUT "Enter second value ", B% 30 C$="First value > second value" 40 D$="First value < second value" 50 E$="First value = second value" 60 IF A%>B% THEN PRINT C$ 70 IF A%120000 THEN 40 PRINT "TIME IS ";TIME$("F"); ". "; 50 PRINT "GO TO LUNCH!" 60 ELSE 70 PRINT "CARRY ON - "; 80 PRINT "THERE'S MORE WORK TO DO!" 90 END IF RUN This results in (for example): TIME IS 12:15. GO TO LUNCH! About Branching Both conditional and unconditional branching is possible in Fingerprint. • For information on conditional branching, see the next section. • For information on unconditional branching, see "Unconditional Branching Using a GOTO Statement" on page 21. • For information on branching to subroutines, see the next section. Branching to Subroutines A subroutine is a range of program lines intended to perform a specific task separately from the main program execution. For example, branching to subroutines can occur when: • an error condition occurs. • a condition is fulfilled, such as a certain key being pressed or a variable obtaining a certain value. • a break instruction is received. Intermec Fingerprint Developer's Guide 17

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187

Chapter 2 — Understanding Fingerprint Syntax
Intermec Fingerprint Developer’s Guide
17
60 END
RUN
Another way to compare the two values in the example above is to use three
IF...THEN statements:
10
INPUT “Enter first value ”, A%
20
INPUT “Enter second value ”, B%
30
C$=“First value > second value”
40
D$=“First value < second value”
50
E$=“First value = second value”
60
IF A%>B% THEN PRINT C$
70
IF A%<B% THEN PRINT D$
80
IF A%=B% THEN PRINT E$
90 END
RUN
Using an IF...THEN...[ELSE]...END IF Instruction
It is also possible to execute multiple THEN and ELSE statements. Each statement
must be entered on a separate line, and the end of the IF...THEN...ELSE instruction
must be indicated by END IF on a separate line. Example:
10
TIME$ = “121500”:FORMAT TIME$ “HH:MM”
20 A%=VAL(TIME$)
30
IF A%>120000 THEN
40
PRINT “TIME IS ”;TIME$(“F”); ”. ”;
50
PRINT “GO TO LUNCH!”
60 ELSE
70
PRINT “CARRY ON - ”;
80
PRINT “THERE’S MORE WORK TO DO!”
90
END IF
RUN
This results in (for example):
TIME IS 12:15. GO TO LUNCH!
About Branching
Both conditional and unconditional branching is possible in Fingerprint.
For information on conditional branching, see the next section.
For information on unconditional branching, see
“Unconditional Branching
Using a GOTO Statement” on page 21.
For information on branching to subroutines, see the next section.
Branching to Subroutines
A subroutine is a range of program lines intended to perform a specific task
separately from the main program execution. For example, branching to
subroutines can occur when:
an error condition occurs.
a condition is fulfilled, such as a certain key being pressed or a variable obtaining
a certain value.
a break instruction is received.