beautypg.com

Nested if–then–else structure, Nested if–then–else structure -25 – Rockwell Automation 9301 Series RSView32 Users Guide User Manual

Page 538

background image

Creating expressions

14–25

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.

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. Keep in mind that the
statement is a mathematical equation and true means a non–zero value,
and false means zero.

The if–then–else structure is illustrated below.

Nested if–then–else structure

It is common to nest an if–then–else structure inside the ‘then’ or
‘else’ part of an if–then–else structure.

value2

value1

enter

statement

exit

true

false