If-then-else, If-then-else -16 – Rockwell Automation FactoryTalk View Machine Edition Users Guide User Manual
Page 494

F
ACTORY
T
ALK
V
IEW
M
ACHINE
E
DITION
U
SER
’
S
G
UIDE
23-16
• •
•
•
•
If-then-else
If-then-else expressions carry out an action conditionally or branch actions depending on
the statements in the expression. The if-then-else statements enable the expression to
perform different actions in different situations and to repeat activities until a condition
changes.
To build conditional expressions, use the relational operators and the logical operators for
the statement and values.
The if-then-else structure is:
if statement then value1 else value2
If the statement is true then the expression returns value1; if the statement is false then the
expression returns value2. If the result of the statement is a non-zero value, the statement
is true (and returns value1); if the result is 0, the statement is false (and returns value2).
The if-then-else structure is illustrated here.