Making Two Things Match

Learn about Elixir's pattern matching.

Introduction to pattern matching

Controlling the program flow means controlling which functions and expressions will be executed. Imperative languages rely mainly on conditional constructors like if, but here in the functional world, pattern matching plays the central role. However, pattern matching is often misunderstood and challenging for beginners to comprehend, which is why half of this chapter is dedicated to understanding it.

Get hands-on with 1200+ tech skills courses.