Overview of Structured Text Programming
Rockwell Automation Publication MOTION-RM002H-EN-P-February 2018 639
ensures that the expression executes in the desired sequence. Refer to Order
of Execution for more information.
In structured text, you use these types of expressions:
BOOL expression: An expression that produces either the BOOL value of 1
(true) or 0 (false).
• A bool expression uses bool tags, relational operators, and logical operators
to compare values or check if conditions are true or false. For example,
tag1>65.
• A simple bool expression can be a single BOOL tag.
• Typically, you use bool expressions to condition the execution of other
logic.
Numeric expression: An expression that calculates an integer or floating-point
value.
• A numeric expression uses arithmetic operators, arithmetic functions, and
bitwise operators. For example, tag1+5.
• Often, you nest a numeric expression within a BOOL expression. For
example, (tag1+5)>65.
String expression: An expression that represents a string
• A simple expression can be a string literal or a string tag
Use this table to choose operators for your expressions.
If you want to Use
Calculate an arithmetic value Arithmetic operators and functions
Compare two values or strings Relational operators
Check if conditions are true or false Logical operators
Compare the bits within values Bitwise operators
See also
Use arithmetic operators and functions on page 640
Use relational operators on page 641
Use logical operators on page 642
Use bitwise operators on page 643