# Erlang Level 3: Data & Pattern Matching

> Level 3: Data & Pattern Matching of the LoWisa Erlang course: Tuples, Maps and Records, Guards, Advanced Pattern Matching. 3 lessons and 9 ideas, each explained in one line.

Data & Pattern Matching is level 3 of 17 of the [LoWisa Erlang course](/courses/erlang/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Tuples, Maps and Records

- **Tuples.** A **tuple** groups fixed fields: {ok, Value} and {error, Reason} are the language’s handshake.
- **Maps.** A **map** holds key-value data: #{name => <<"Ada">>}: matched with := on known keys.
- **Records.** A **record** is compile-time sugar over tuples: named fields for module-internal structure.

## Guards

- **Guards.** A **guard** refines a match: when X > 0: from a restricted, side-effect-free set of tests.
- **Guard sequences.** Guards combine with comma (and) and **semicolon** (or): compact truth tables on clauses.
- **Guards versus function calls.** Only **built-in** tests may guard: your own functions cannot, by design, so guards stay pure.

## Advanced Pattern Matching

- **Binaries.** The **binary** syntax matches bytes: <<Len:16, Body:Len/binary>>: protocol parsing as patterns.
- **Nested matching.** Patterns nest deep: {user, #{address := #{city := **City**}}}: one line reaching inside.
- **Match in every seam.** Erlang **matches** everywhere: function heads, case, receive: one mechanism across the whole language.

## Before and after this level

- **Before:** [Level 2: Functional Erlang](/courses/erlang/level-2-functional-erlang/): Recursion, Lists and Higher-Order Functions, Immutable Data Transformation.
- **Next:** [Level 4: Processes](/courses/erlang/level-4-processes/): Lightweight Processes, Message Passing, Mailboxes and Receive.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Erlang Level 3: Data & Pattern Matching cover?

Tuples, Maps and Records, Guards, Advanced Pattern Matching: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 2: Functional Erlang, which covers Recursion, Lists and Higher-Order Functions, Immutable Data Transformation.

## Learn Erlang on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/erlang/level-3-data-and-pattern-matching/ · Updated 2026-11-25
