[swift-evolution] Proposal: "if switch x case" and "for switch x case ... in"

Donnacha Oisín Kidney oisin.kidney at gmail.com
Sun Jan 10 20:22:28 CST 2016


I think that syntax already exists:

let x = 2

if (1...3).contains(x) { print(1) }

let ar: [Int?] = [1, 2, nil, 4]

for case x? in ar {
  print(x)
}

> On 11 Jan 2016, at 00:58, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Examples:
> 
> if switch x case 1…3 { … }
> 
> for switch x case .Some(_) in args { print(x!)  }
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list