Chapter 5. Control Flow – Occasionally You Need to Branch
We're nearly half way through the book, and we will just be getting into control statements, otherwise known as branching statements. This again speaks to the power and flexibility of pattern matching and stream processing available in Elixir. We can write a number of algorithms without even an if then else
structure. We have programmed quicksort
, we just recently reversed a graph structure, and we will do more without these control structures. But, occasionally, we will need a branching structure. For those situations, we will use expressions, such as if true do "something" end
, or a number of other possibilities given to us by the branching constructs built into Elixir.