Erlang / Erlang Basics Interview questions
What are atoms in Erlang?
An atom is a constant whose only value is its own name — think of it as a symbolic label rather
than a variable. Atoms are written lowercase (ok, error, undefined) or
quoted if they contain spaces or start with a capital ('My Atom').
They're used everywhere as tags: function results like {ok, Value} or
{error, Reason}, process states, and message types all lean on atoms so the receiving code can
pattern-match on a clear, self-documenting label instead of a raw number or string.
Atoms are stored once in a global atom table and compared by reference, so matching on them is essentially an integer comparison — fast, regardless of how long the atom's name is.
More Related questions...