Skip to content

Commit

Permalink
[elixir/en] Give more context around comparison operators (#4792)
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim authored May 13, 2024
1 parent 5aa4443 commit e8d07ad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions elixir.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ nil && 20 #=> nil
1 == 1.0 #=> true
1 === 1.0 #=> false

# We can also compare two different data types:
# Elixir operators are strict in theiar arguments, with the exception
# of comparison operators that work across different data types:
1 < :hello #=> true

# The overall sorting order is defined below:
# number < atom < reference < functions < port < pid < tuple < list < bit string
# This enables building collections of mixed types:
["string", 123, :atom]

# To quote Joe Armstrong on this: "The actual order is not important,
# While there is an overall order of all data types,
# to quote Joe Armstrong on this: "The actual order is not important,
# but that a total ordering is well defined is important."

## ---------------------------
Expand Down

0 comments on commit e8d07ad

Please sign in to comment.