Guard Clauses

Learn how to call a specific function using when as a predicate in the function definition.

We'll cover the following...

When to use guard clauses

We’ve seen that pattern matching allows Elixir to decide which function to invoke based on the arguments passed. But what if we need to distinguish based on the argument types or on some test involving their values?

For this, we use guard ...