Atoms
An atom is a constant whose value is its own name. Some other languages call these symbols.
Atoms can be created using a preceding colon, like :apple or :orange.
Atoms with the same name are equal:
:apple == :apple
Atoms with different names are not equal:
:apple == :orange
true, false and nil are also atoms - Elixir allows to skip the colon for them:
# 💡 Try using `is_boolean` to check if atom `:false` is a boolean.
is_atom(true)
true and :true are the same:
true == :true
Other commonly used atoms are :ok and :error. They usually denote a success or a failure of some operation. For example, IO.puts/1 always returns :ok:
IO.puts("foo")