links: Elixir MOC


Atoms

An Atom is a constant whose value is its own name. Some other languages call these symbols. They often useful to enumerate over distinct values

variable = :an_atom

Atoms are equal if their names are equal

:apple == :apple
# => true
 
:apple == :orange
# => false

Often they are used to express the state of an operation, by using values such as :ok and :error

The boolean true and false are also atoms

true == :true
# => true
 
is_atom(false)
# => true
 
is_boolean(:false)
# => true

tags: elixir atoms

sources: