Are "function's block", "loop's block", etc. good terminology?

Generally I think it makes most sense to talk about loop or function bodies, however, blocks are still an important concept. Consider the following code:

func foo() {
    // Do stuff...
    {
        bar := true
    }
    // bar is out of scope.
}

Here I’ve used a code block to define a variable that is out of scope after the block is executed. Same as what happens with if statements and for loops.

1 Like