April 2024
Beginner to intermediate
224 pages
5h 7m
English
Pattern matching will change the way that you write code. It’s a simple—yet extremely powerful—feature that’s built into the foundation of Elixir. Pattern matching is used in function definitions, variable assignments, and control flows—it’s a core port of the language’s design. And once you master it, you won’t want to go back.
In Ruby (and most languages), the core structures for control flow are if statements. This is easy to use if you want to check whether a value is one of two candidate values—true or false. It becomes cumbersome if you want to check whether a value is one of many possible values—based on string contents, array values, map keys, and so on. Elixir has if statements, but it ...
Read now
Unlock full access