Operator ‘AND_THEN’ΒΆ

This operator is an extension of the IEC 61131-3 standard.

The AND_THEN operator is permitted only for programming in structured text with the AND operation of BOOL and BIT operands with short-circuit evaluation. This means that:

When all operands yield TRUE, the result of the operands also yield TRUE; otherwise FALSE.

However, CODESYS also executes the expressions on other operands only if the first operand of the AND_THEN operator is TRUE. This can prevent problems with null pointers, for example in conditions such as IF (ptr <> 0 AND_THEN ptr^ = 99) THEN....

In contrast, CODESYS always evaluates all operands when using the AND IEC operator.

See also