April 2024
Beginner to intermediate
224 pages
5h 7m
English
Pattern matching goes well beyond assigning variables. Control flow—the branching logic of your application—is performed with pattern matching. Most programming languages rely on if statements for all (or close to all) of an application’s control flow. But Elixir offers more choices.
We’ll go over four control flow structures: if, case, with, and cond. They all have different purposes and situations where you’ll use them, but case statements are the most commonly used.
Let’s start with if statements.
If statements are so common that it would be a bit strange for Elixir to not have them. Elixir’s if statements work largely like you’re used to. Use if to quickly check whether a value is truthy or falsy. ...
Read now
Unlock full access