151
Statement Descriptions
Section 5-5
Note
ELSE can be omitted.
Statement Syntax
IF
<
condition_1
>
THEN
<
expression_1
>
;
ELSIF
<
condition_2
>
THEN
<
expression_2
>
;
ELSIF
<
condition_3
>
THEN
<
expression_3
>
;
...
ELSIF
<
condition_n
>
THEN
<
expression_n
>
;
ELSE
<
expression_m
>
;
END_IF;
Processing Flow Chart
■
Usage
Use the IF statement to perform different operations depending which of mul-
tiple conditions (
condition
equation) is met.
■
Description
Condition 1 = If true, execute expression 1
Condition 1
= If false,
Condition 2
= If true, execute
expression 2
Condition 2
= If false,
Condition 3
= If true, execute
expression 3
etc.
Condition n
= If true, execute
expression n
If none of these conditions are met,
condition m
is executed.
■
Precautions
• IF must be used together with END_IF.
•
Condition_
@
contains the true or false result of the equation (e.g.,
IF(A>10)).
A boolean (BOOL data type) variable only can also be specified as the
condition
rather than an equation. For boolean conditions, the result is
true when the variable value is 1 (ON) and false when it is 0 (OFF).
• Statements that can be used in
expression_
@
are assignment state-
ments, IF, CASE, FOR, WHILE, or REPEAT.
Condition 1
Condition 2
Condition 3
False
False
False
True
True
True
Expression 1
Expression 2
Expression 3
Expression m
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......