Return early
There is no return
keyword so code must be organized to return early. The follow example shows how to organize code to return early in Elixir.
For example, the early return in ruby:
Could look like this in Elixir:
Case and cond can also be used to return different values based on a condition.
See Also: