CR10X User Guide
3-6
3.8.1 If Then / Else Comparisons
Program Control Instructions can be used for ‘If then/else’ comparisons. When
Command 30 (Then do) is used with Instructions 83 or 88-92, the If instruction is
followed immediately by instructions to execute if the comparison is true. The
Else instruction (Instruction 94) is optional and is followed by the instructions to
execute if the comparison is false. The End instruction (95) ends the ‘If then/else’
comparison and marks the beginning of the instructions which are to be executed
regardless of the outcome of the comparison (see Figure 3-1).
Figure 3-1 If Then/Else Execution Sequence
‘If Then/Else’ comparisons may be nested to form logical AND or OR branching.
Figure 3-2 illustrates an AND construction. If conditions A and B are true, the
instructions included between IF B and the first End instruction are executed. If
either of the conditions is false, execution jumps to the corresponding End in-
struction, skipping the instructions between.
Figure 3-2 Logical AND Construction