mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
[elixir/en] Give more context around comparison operators (#4792)
This commit is contained in:
parent
5aa44434a2
commit
e8d07adad1
@ -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."
|
||||||
|
|
||||||
## ---------------------------
|
## ---------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user