2-25
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
ST Statement Instructions
2
IF
The flowchart in the following example shows the evaluation results for condition expressions 1 and 2.
You can use more than one statement for each of statements 1 to 3.
IF condition expression 1 THEN
statement 1;
ELSIF condition expression 2 THEN
statement 2;
ELSE
statement 3;
END_IF;
• You can use the IF construct to build a hierarchy. The following example executes statement 11 if the
evaluation results of both condition expression 1 and condition expression 11 are TRUE.
IF condition expression 1 THEN
IF condition expression 11 THEN
statement 11;
ELSIF condition expression 12 THEN
statement 12;
ELSE
statement 13;
END_IF;
ELSIF condition expression 2 THEN
statement 2;
ELSE
statement 3;
END_IF;
OR Logical OR a OR b The result is the logical OR of BOOL variables a and b.
XOR Exclusive OR a XOR b The result is the logical exclusive OR of BOOL variables a and
b.
NOT NOT NOT a The result is the NOT of BOOL variable a.
Additional Information
Operator Meaning Example Evaluation result
FALSE
TRUE
FALSE
TRUE
Condition
expression 1
Condition
expression 2
Statement 1
Statement 3
Statement 2