Blocks and lexical scoping
A block is an expression that encapsulates one or more statements or
expressions, and is enclosed by
The last statement in a block must be an expression.
A block is itself an expression, and has the type and result of the last expression of the block:
A block defines variable scope. Variables declared in a block are scoped to the block and can’t be referenced outside of the block.
[ "foo", "bar" ]
In the example, two
x variables are declared. One with local scope and
one with global scope. Variable
y has global scope and is the value
of the block.
Is this article helpful?
Tell Fauna how the article can be improved:
Thank you for your feedback!