[swift-evolution] Change 'for in' expression to for [] { (item) in ... }

Kwanghoon Choi eyerama at gmail.com
Fri Jul 28 11:19:27 CDT 2017


Hello

I found someone easy mistake using for in loop statement.

Ex)
var i = 0
for i in 0..<10 { }
print(i)

And this user expected print(i) is “10”

Many experienced swift developers doesn’t misunderstand like this. But always someone is new comers, and I think this expression make misunderstand easy too.

So why not like this?

var I = 0
for 0..<10 { (i) in … }

I think this is more understandable for loop expression. 

Best Regards

- Jay Choi


More information about the swift-evolution mailing list