- Only
nil
andfalse
are considered false (falsy values), everything else is considered true (truthy values). The following may surprise those coming from C/Python
iex(1)> x = 0
0
iex(2)> if x do
...(2)> "True condition matched"
...(2)> else
...(2)> "False condition matched"
...(2)> end