Use relational operators
Relational operators compare two values to provide a true or false result. The result of a relational operation is a
BOOL value.
If the comparison is | The result is |
True | 1 |
False | 0 |
Use these relational operators.
For this comparison | Use this operator |
Equal | = |
Less than | < |
Less than or equal | <= |
Greater than | > |
Greater than or equal | >= |
Not equal | <> |
The table provides examples of using relational operators
Use this format | Example | |
For this situation | Write | |
value1 operator value2 | If temp is a DINT tag and your specification says: ‘If temp is less than 100⋅ then…’ | IF temp<100 THEN... |
bool_tag := bool_expressions | If count and length are DINT tags, done is a BOOL tag, and your specification says: ‘If count is greater than or equal to length, you are done counting.’ | Done := (count >= length); |
Provide Feedback