I like this idea, but I don't have enough detail to +1.<div><br></div><div>It would be good to show how all current switch behaviour would work.</div><div><br></div><div>How would 'break' and 'fallthrough' work?</div><div><br></div><div>It seems 'break' is redundant now.</div><div><br></div><div>Would the following code's 'break' act on the switch, or on the for loop?</div><div><br></div><div>for i in 0...5 {</div><div> switch i {</div><div> case 4 { break }</div><div> default { print(i) }</div><div> }</div><div>}</div><div><br>On Saturday, 30 January 2016, Haravikk via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I’d say to make it optional, as the use of just a colon is great for compact switch statements with short cases, so I think they’re worth retaining.</div><div><br></div><div>Actually, one thing we don’t have in Swift is the ability to just put blocks (curly braces) wherever we like, which in some languages is a useful tool for variable scope when you know you only need something for a short time, but might want to re-use the name. Currently they just result in a “trailing closure separated by multiple new-lines” warning, so they could perhaps be made available, in which event you could use them in larger case statements whenever you wished.</div><br><div><blockquote type="cite"><div>On 29 Jan 2016, at 22:45, Rudolf Adamkovič via swift-evolution <<a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div style="word-wrap:break-word"><div>+2 from me! One for curly braces and one for proper indentation.</div><div><br></div><div>R+</div><br><div><blockquote type="cite"><div>On 28 Jan 2016, at 02:35, Joseph Essin via swift-evolution <<a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="ltr">As a budding iOS developer, I thought it might be nice if Swift were to further improve on C's <i>switch</i> statement by using curly brackets to denote a block instead of a colon. It seems like this would be more consistent with the language at large and make indention more intuitive.<div><br></div><div>Here's a quick example of what it might be.</div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">switch </span><i style="font-size:12.8px">value</i><span style="font-size:12.8px"> </span><span style="font-size:12.8px">{</span><br></div><div><div style="font-size:12.8px"> case <i>expression</i> {</div><div style="font-size:12.8px"> }</div><div style="font-size:12.8px">}</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I apologize if this message isn't in the right format--I've not used a mailing list before.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Joseph Essin</div></div>
_______________________________________________<br>swift-evolution mailing list<br><a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div>_______________________________________________<br>swift-evolution mailing list<br><a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></blockquote></div>