Scope
Erlang is very relaxed in its scoping rules, and does not, in many cases, abide by lexical scoping.
Joining scopes#
In the case where control flow splits into several branches, if a variable is bound in all branches, the variable will be available in the outer scope as well.
This works on both case expressions, if expressions and receive expressions.