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.
Usage
The equality operators as comparison operator are used in predicate (condition) expression in order to:
- and execute conditionally.
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
Mathematics
- Approximately equal
<MATH> a \approx b </MATH>
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 <=
See: