"if case" syntax is ugly


(Amir Michail) #1

Maybe instead of: if case 1...3 = x { … }

You could have: if x case 1..3 { … }

And loops could be handled similarly: for x case 1..3 in z { … }


(Chris Lattner) #2

Hi Amir,

It is hard to understand how your proposal would work. Could you suggest a change to the formal grammar, which is described in the TSPL (https://swift.org/documentation/)?

-Chris

···

On Dec 5, 2015, at 5:14 AM, Amir Michail <a.michail@me.com> wrote:

Maybe instead of: if case 1...3 = x { … }

You could have: if x case 1..3 { … }

And loops could be handled similarly: for x case 1..3 in z { … }