O'Reilly logo

Learning Elixir by Kenny Ballou

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Branching with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required