beautypg.com

Nested if - then - else, Example 1: nested if - then- else, Nested if-then-else – 20 – Rockwell Automation FactoryTalk View Site Edition Users Guide User Manual

Page 566: Nested if-then-else

background image

F

ACTORY

T

ALK

V

IEW

S

ITE

E

DITION

U

SER

S

G

UIDE

20–20

• •

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.

Following is an illustration of the if–then–else structure:

Nested if-then-else

It is common to nest an if-then-else structure inside the then or else part of an if-then-

else structure.

Example 1: Nested if -then- else

This expression:

If statement1 Then value1

Else if statement2 Then value2

Else value3

is interpreted in this way:

value2

value1

enter

statement

exit

true

false