Label Scope

labels are declared by label statements and are used in "break", "continue" and "goto" statements. It is illegal to define a label that is never used.

In contrast to other identifiers, labels have no block scope and do not conflict with non-label identifiers.

The scope of a label is the body of the function in which it is declared and excludes the body of any nested functions.


myLabel:
    // code
                        
label_scope.go