[swift-evolution] [Idea] Wrap switch cases in curly braces

Brent Royal-Gordon brent at architechies.com
Thu Jul 7 16:11:10 CDT 2016


> On Jul 7, 2016, at 2:05 PM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
> 
> There's also the issue of scope; you can fall through from a case, so technically speaking the only scope may be the switch itself, as you could fall through every single case and thus visit everything on the way down.

But they *are* separate scopes. A `let` in one case doesn't remain available in the next.

I prefer braces to colons, but I think I've made this argument before and lost to the "we don't deviate from C just for the hell of it" rule.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list