2 ms·
> unlike calling a function, the compiler's not obligated to set up or tear down a context I guess it depends on what you mean by "context" but the spec is ve
by ollien 4y ago
> unlike calling a function, the compiler's not obligated to set up or tear down a context
I guess it depends on what you mean by "context" but the spec is very clear that a block creates scope, and the end removes scope.
https://go.dev/ref/spec#Declarations_and_scope https://go.dev/ref/spec#Declarations_and_scope
> The scope of a constant or variable identifier declared inside a function begins at the end of the ConstSpec or VarSpec (ShortVarDecl for short variable declarations) and ends at the end of the innermost containing block.