EQ

Returns TRUE if two inputs are equal.

Signature

     ┌─────────┐
IN1 ─┤         │
     │   EQ    ├─ OUT
IN2 ─┤         │
     └─────────┘
FUNCTION EQ : BOOL
  VAR_INPUT
    IN1 : ANY_ELEMENTARY;
    IN2 : ANY_ELEMENTARY;
  END_VAR
END_FUNCTION

Returns BOOL. EQ accepts SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT, REAL, LREAL. Both inputs must share the same type.

Inputs

Name

Type

Description

IN1

ANY

The first value to compare.

IN2

ANY

The second value to compare.

Outputs

Name

Type

Description

Return value

BOOL

TRUE if IN1 equals IN2, otherwise FALSE.

Description

Returns TRUE if IN1 is equal to IN2, FALSE otherwise. EQ(a, b) is the functional form of the = operator: a = b. Both forms are equivalent.

For REAL and LREAL types, equality comparison is subject to floating-point precision limitations.

Example

result := EQ(5, 5);     (* result = TRUE *)
result := 5 = 5;        (* result = TRUE, operator form *)
result := 5 = 10;       (* result = FALSE *)

See Also

  • NE — not equal

  • GT — greater than

  • LT — less than

References