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 - Usage

The equality operators as comparison operator are used in predicate (condition) expression in order to:

  • filter
  • and execute conditionally.

4 - Operator

Equality operator

Operation Description
== 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
<> loose not-equals (should be deprecated)
!== strict not-equals
is object identity
is not negated object identity
The operator = is generally not a comparison operator but an assignment operator

5 - Mathematics

  • Approximately equal

<MATH> a \approx b </MATH>

6 - Evil in loop 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 <=


Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap