In some of the previous recipes, we've been using the
= operator. When we execute something like
a = 1, we are not performing an assignment; we are, instead, binding the value
This is actually pattern matching in its simplest form. The
= operator is, in fact, called the match operator.
Start a new IEx session in your console.
To exercise our pattern matching techniques, we will follow these steps:
iex(1)> birthday_list = [andrew: "October 2nd", jim: "May 1st", carrie: "September 23rd", Carla: "August 30th"] [andrew: "October 2nd", jim: "May 1st", carrie: "September 23rd",carla: "August 30th"]