A switch statement _ its own lexical block. Each case statement _ an additional lexical block
switch
case
does not create; creates
does not create; does not create
creates; creates
creates; does not create Go Language Core technology (Volume one) 1.5-scope Relevant excerpt from the article:
The second if statement is nested inside the first, so a variable declared in the first if statement is visible to the second if statement. There are similar rules in switch: Each case has its own lexical block in addition to the conditional lexical block.