Atoms In Elixir — Tentamen Software Testing Blog


In the previous post, we explained Elixir Numbers. Today we discuss Elixir literal named constants, atoms. This post is part of the functional language series, and it is based on the remarkable book Elixir In Action by Sasa Juric.

We use atoms as constants that we assign to variables. Atom name consists of alphanumeric characters with _. We can also have an atom with spaces. Atom table is a table in BEAM where all atoms are stored. If two variables have the same atom value, they share that value. Doing that, Elixir’s programs are efficient regarding memory and performance.

Atom alias is when you name something with the first uppercase letter.

:true and :false are atoms reserved for Boolean value. All logical operators work with those two atoms. You can omit :

Nil in Elixir is also an atom: :nil == nil


Originally published at on July 12, 2020.