[swift-evolution] Proposal: Remove the "fallthrough" keyword

Chris Lattner clattner at apple.com
Tue Dec 8 23:39:34 CST 2015


> On Dec 7, 2015, at 1:42 PM, Kevin Ballard via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Or alternatively, if you want to preserve `break` in the switch, you can write it so `continue` is required to repeat:
>  
> var value = ...
> repeat {
>     switch value {
>     case ...:
>         ...
>         // reswitch
>         value = ...
>         continue
>     case ...:
>         break
>     }
>     break
> } while true
>  

We support labeled break out of switches and if statements.  While we intentionally do not support labeled continue on these constructs, that would be another way to express this sort of construct, without adding another level of indentation.  We don’t support labeled continue on them because we expressly did not want to turn “if” into a loop :-), but also out of conservatism.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151208/ee8023b8/attachment.html>


More information about the swift-evolution mailing list