Language - Equality

1 - About

The Equality operators model the Equivalence relation:

  • equality
  • is parallel to (for affine spaces)
  • is in bijection with
  • isomorphy

The Equality operators are a subset of the comparison operator.

The = symbol was designed to be two lines of visibly equal length.

3 - Evil in predicate

The equality operator is evil in a loop predicate.

The common error is to find a == in the code where there should have been a >= or a <=


4 - Operator

Equality operator

  • ==: loose-equals, same value, two different Type such as '2' in number of '2' as string are loose-equals
  • === strict-equals, same value, same type,
  • != loose not-equals,
  • !== strict not-equals
Operation Description
== equal
!= not equal (<> is deprecated)
is object identity
is not negated object identity

The operator = is generally not a comparison operator but an assignment operator

code/grammar/equal.txt ยท Last modified: 2018/11/24 12:25 by gerardnico