Elixir and pattern matching

I’ve been a little confused about pattern matching. I see this in use with case statements. It is especially difficult because in Elixir there is no return, every statement returns a value.

This made a difference:

In Elixir, the = operator is actually called the match operator.

From: https://elixir-lang.org/getting-started/pattern-matching.html#the-match-operator

This code is interesting and illuminating:

iex> x = 1 
1 
iex> 1 = x
1 
iex> 2 = x ** (MatchError) no match of right hand side value: 1