Julia LanguageComparisons


Syntax

  • x < y # if x is strictly less than y
  • x > y # if x is strictly greater than y
  • x == y # if x is equal to y
  • x === y # alternatively x ≡ y, if x is egal to y
  • x ≤ y # alternatively x <= y, if x is less than or equal to y
  • x ≥ y # alternatively x >= y, if x is greater than or equal to y
  • x ≠ y # alternatively x != y, if x is not equal to y
  • x ≈ y # if x is approximately equal to y

Remarks

Be careful about flipping comparison signs around. Julia defines many comparison functions by default without defining the corresponding flipped version. For instance, one can run

julia> Set(1:3) ⊆ Set(0:5)
true

but it does not work to do

julia> Set(0:5) ⊇ Set(1:3)
ERROR: UndefVarError: ⊇ not defined