Operators & Term Ordering
Prefer =:= and =/= unless you deliberately compare ints with floats.
5.2 Comparison
exactly equal (1 =:= 1.0 → false) exactly not equal equal (1 == 1.0 → true) less than or equal (not <=!)
Prefer =:= and =/= unless you deliberately compare ints with floats.
5.3 Boolean
Use andalso/orelse in most code.
true and false, % false — evaluates both sides
true or false, % true
not true, % false
true xor false, % true
false andalso X, % short-circuit: X not evaluated
true orelse X % short-circuit5.4 Bitwise
band, bor, bxor, bnot, bsl (shift left), bsr (shift right).
5 band 3, % 1
1 bsl 4. % 165.5 Term ordering
Any two terms can be compared:
Tuples compare by size first, then element-wise; lists compare element-wise.
number < atom < reference < fun < port < pid < tuple < map < nil ([]) < list < bitstring5.6 Operator precedence (high → low)
# (record/map access) unary + - bnot not / * div rem band and (left) + - bor bxor bsl bsr or xor (left) ++ -- (right) ?= (maybe match)