Scopes
Loop features block scoping, meaning that every block will define their own scope. A scope will always be able to access its outer scope. This allows you to create closures as well.
In Loop every variable is scoped. Because functions are variables internally as well they will be scoped too.
General Scoping
Creating a scope is extremely easy and happens with almost every control expression.
This implies that an if-expression also has a deeper scope.
Scopes are not limited to a single depth, so you can nest them as deep as you'd like.
Example
The best way to illustrate this is with an example. We will be using the last code segment of the previous section. While doing this we will add some variable assignments and accessors.
Last updated