Basics for Elixirs
Elixir basics are the core of the language: immutable data types such as atoms, tuples, lists and maps, pattern matching with the = operator, and functions organised into modules. Pattern matching in function heads replaces most if statements and drives how Elixir code is structured.
Stage: Language · Part of the Elixir roadmap · Last reviewed 19 November 2026
What to learn in Basics
- Use pattern matching to destructure tuples, lists and maps in assignments
- Write multi-clause functions with guards instead of nested conditionals
- Chain transformations with the pipe operator and Enum functions
- Choose between lists, tuples, maps and keyword lists for a given job
- Organise functions in modules and call them from iex
Basics interview questions
What does the = operator do in Elixir?
It is the match operator, not plain assignment. The left side is a pattern that must fit the right-hand value, binding variables where it can. So {:ok, value} = {:ok, 42} binds value to 42, while a mismatched shape raises a MatchError.
Why are lists in Elixir poor for random access?
Lists are linked lists, so reaching the nth element means walking n cells. Prepending is cheap and constant time, which is why recursion over head and tail is idiomatic. For indexed or key-based access, maps or tuples are the better choice.
Where Basics fits in the Elixir roadmap
Basics belongs to the Language stage (beginner level). Functional basics.
Back to the full Elixir roadmap