[swift-evolution] Proposal: "if switch x case" and "for switch x case ... in"
Amir Michail
amichail at gmail.com
Mon Jan 11 08:22:12 CST 2016
> On Jan 10, 2016, at 9:22 PM, Donnacha Oisín Kidney <oisin.kidney at gmail.com> wrote:
>
> 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)
> }
I think what I proposed might be a more intuitive replacement for the existing “if case” and “for case”.
>
>> On 11 Jan 2016, at 00:58, Amir Michail via swift-evolution <swift-evolution at swift.org <mailto: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 <mailto: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/bd0b0ac3/attachment.html>
More information about the swift-evolution
mailing list