Instructor: Reason has lexical scoping. Don't worry in case you aren't familiar with this term, as in this lesson, I will guide you through the relevant implications.
First, we create the local scope using curly braces. It can contain one or multiple imperative statements, while the last one will automatically be returned. In this case, the value of the scope is the same as if we would type 42.
Inside a scope, we can access bindings outside of its current scope, but let bindings defined inside a scope aren't accessible from the outside. In fact, we can shadow a let binding inside a scope, and it won't affect the let bindings outside of this local scope, even with different types.
Here, we bind the string Hello to the name foo. Then we create the scope where we bind the integer two to the name foo again. If you refer to foo outside of the block, it's still Hello. Since every block returns the last statement as an expression, we can also bind the result to a name.
In the coming lessons, we will see blocks being used many times to create a local scope for constructs like switch expressions or function definitions. Keep in mind, every time curly braces are used in Reason, it's the same scoping behavior.