February 2018
Beginner
200 pages
4h 37m
English
Working with functional programming, we use function clauses to control the flow of the program. It’s the expected behavior of a functional programmer, but it doesn’t mean we can’t use some Elixir built-in control-flow structures, such as case, cond, if, and unless, to develop features quickly. We’ll see how each one can be useful and how it works.
case is useful when we want to check an expression with multiple pattern-matching clauses. It’s helpful for dealing with functions that may have an unexpected effect. To see how it works, we’ll change our script that calculates the abilities modifier for RPG players:
| | user_input ... |
Read now
Unlock full access