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
Содержание SYSMAC CX-Programmer 9
Страница 2: ......
Страница 4: ...iv ...
Страница 6: ...vi ...
Страница 8: ......
Страница 16: ...xvi ...
Страница 20: ...xx ...
Страница 26: ...xxvi Application Precautions 4 ...
Страница 27: ...Part 1 Function Blocks ...
Страница 28: ......
Страница 154: ...128 Procedures Section 3 2 ...
Страница 155: ...Part 2 Structured Text ST ...
Страница 156: ......
Страница 160: ...134 CX Programmer Specifications Section 4 2 ...
Страница 206: ...180 Procedures Section 6 1 ...
Страница 208: ...182 System defined external variables supported in function blocks Appendix A ...
Страница 230: ...204 Revision History ...
Страница 231: ......