Use of the if and unless Keywords
Explore how to apply the if and unless keywords in Elixir to manage control flow within your programs. Understand when and how to use these constructs efficiently and see alternatives that promote functional programming style.
We'll cover the following...
We'll cover the following...
In Elixir, we write lots of small functions. A combination of guard clauses and pattern matching of parameters replaces most of the control flow seen in other languages.
However, Elixir does have a small set of control-flow constructs. The reason we waited so long to introduce them is that we should try not to use them much. We should drop the occasional cond or case into our code. But ...