[elixir/en] Give more context around comparison operators (#4792)

This commit is contained in:
José Valim 2024-05-13 19:03:23 +02:00 committed by GitHub
parent 5aa44434a2
commit e8d07adad1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,13 +146,15 @@ nil && 20 #=> nil
1 == 1.0 #=> true 1 == 1.0 #=> true
1 === 1.0 #=> false 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 1 < :hello #=> true
# The overall sorting order is defined below: # This enables building collections of mixed types:
# number < atom < reference < functions < port < pid < tuple < list < bit string ["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." # but that a total ordering is well defined is important."
## --------------------------- ## ---------------------------