Elixir Language Operators Comparison operators


Example

Equality:

  • value equality x == y (1 == 1.0 # true)
  • value inequality x == y (1 != 1.0 # false)
  • strict equality x === y (1 === 1.0 # false)
  • strict inequality x === y (1 !== 1.0 # true)

Comparison:

  • x > y
  • x >= y
  • x < y
  • x <= y

If types are compatible, comparison uses natural ordering. Otherwise there is general types comparison rule:

number < atom < reference < function < port < pid < tuple < map < list < binary