Truthiness determines how Elixir evaluates a value in short-circuit expressions. Only false and nil are falsy; every other value is truthy. section 2.4.2 section 2.5
Use the short-circuit operators according to the value they return:
- || returns the first truthy expression, or the final expression when all expressions are falsy. section 2.4.2 section 2.5
- && returns the first falsy expression; otherwise it returns the second expression. section 2.4.2 section 2.5
- ! returns false for a truthy value and true for a falsy value. section 2.5
Fallbacks and guarded work
Chain fallback sources with read_cached() || read_from_disk() || read_from_database(). Guard dependent work with connection && read_data(connection); the second expression is skipped when connection is nil or false. section 2.4.2 section 2.4.2
:an_atom :another_atom
Compare representative short-circuit expressions and their returned values. section 2.4.2





