Relational and logical operators – Rockwell Automation T7833 ICS Regent+Plus Math Package for Winternet User Manual

Page 6

Advertising
background image

Math Package for W

INTERPRET

(T7833)


6

Industrial Control Services

ENDW

If the expression is true (not zero), loop statements are
executed until the ENDW statement is encountered. Floating
point math then returns to the WHILE statement and checks
expression. If expression is still true, the process is repeated.
If the expression is not true, execution resumes with the
statement following the ENDW statement.

To avoid infinite loops, the expression must be modified (its
value changed) during repeated execution to make the

expression false and exit the loop.

WHILE and ENDW statements may be nested.

Relational and Logical Operators

Relational and logic operators are often used in the
expressions for IF and WHILE statements to control the
execution of other mathematical statements.

Relational Operators

Relational operators compare two values. The result of the
comparison is either true (1) or false (0). The result can then
be used to make a decision regarding program flow. The
relational operators are shown in Table 3.

Table 3. Relational Operators.

Operator

Relation Tested

Expression

=

Equality

X = Y

<>

Inequality

X <> Y

<

Less than

X < Y

>

Greater than

X > Y

<=

Less than or equal to

X <= Y

>=

Greater than or equal to

X >= Y

When arithmetic and relational operators are combined in
one expression, the arithmetic is always performed first.

Important!

Advertising