Atoms In Elixir — Tentamen Software Testing Blog

TL;DR

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.

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

Nil in Elixir is also an atom:

Remember

  • atom naming rules
  • atoms with spaces
  • why are atoms efficient
  • atom table
  • aliases
  • and are atoms because there is no Boolean type in Elixir
  • is also an atom

Originally published at https://blog.tentamen.eu on July 12, 2020.

Founder of Tentamen, software testing agency.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store