> On Jun 9, 2016, at 7:15 PM, Erica Sadun via swift-evolution
> <[email protected]> wrote:
>
>
>> On Jun 8, 2016, at 10:17 PM, Sean Heber <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>
>> On Jun 8, 2016, at 10:51 PM, Erica Sadun via swift-evolution
>> <[email protected] <mailto:[email protected]>> wrote:
>>> I saw your post on that *after* I finished sending this. Moving `where`
>>> next to the pattern, like you'd find in `catch` and switch `case`, the code
>>> would look like this:
>>>
>>> for i where i % 2 == 0 in sequence {
>>> // do stuff
>>> }
>>
>> This is the best version yet - the placement of 'where' makes total sense
>> and I really like it there.
>>
>
> I really like how it aligns with case statements better. BUT I think using
> guard is still better because
> there's still user confusion between "does this terminate" and "does this
> filter".
>
> Guard use is unambiguous.
It may seem superfluous, but what about something like
for i in sequence where i % 2 == 0 else continue {
/// do stuff
}
for i in sequence where i % 2 == 0 else break {
/// do stuff
}
Which would make it explicit whether the for-loop should filter or break, yet
it's still a one-liner...
>
> -- E
>
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution