[swift-evolution] class indent in swift, history?

Rob Mayoff mayoff at dqd.com
Wed Mar 8 11:23:55 CST 2017


On Wed, Mar 8, 2017 at 5:09 AM, Haravikk via swift-evolution <
swift-evolution at swift.org> wrote:

> willSet and didSet have their own distinct scope; they execute
> independently, however a switch statement is effectively a single scope
> because of the ability to use fallthrough to visit later cases.
>

A switch statement has a separate scope for every case, including default.
Example:

switch Int() {
case 0:
    let m = "zero"
    fallthrough
default:
    Swift.print(m)
}


Result:

Playground execution failed: error: MyPlayground.playground:2:17: error:
use of unresolved identifier 'm'
    Swift.print(m)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170308/cc92c873/attachment.html>


More information about the swift-evolution mailing list