if statement
- Format
Format
if <condition> then <label name>
- Explanation
Use this instruction to branch processing conditionally.
When <condition> is met, processing branches to the step labeled with <label name> described after
"then."
<condition>:
Specifies a conditional expression among those listed in Section 3.5, "Conditions," of
Chapter 3, "Syntax."
<label name>: Specifies the label name of the branch-target step (line).
- Processing cycle
Note that <condition> check and branch processing are executed in the same cycle.
Refer to the statement execution sequence indicated by parenthesized numbers in the comment fields
of the sample programs below.
- Sample program
Yw =
if
if
Y(00) =
goto
LABEL1
Y(01) =
goto
LABEL2
Y(02) =
LABEL3
Y(03) =
Instruction to branch processing unconditionally
When <condition> is met, processing branches to the step labeled with
<label name>.
When <condition> is not met, processing proceeds to the next step
(line).
0
X(00) = 1 then
LABEL1
X(01) = 1 then
LABEL2
1
LABEL3
1
LABEL3
1
1
Chapter 5 Instruction Words
Description
: Turn off terminals Y (00) to Y (05).
: (1) When <condition> is met, branch to step "LABEL1."
: (2) When <condition> is met, branch to step "LABEL2."
: (3)
: (4)
:
:
:
(3)
: (5)
(4)
5 - 7
(2)
(3)
(4)