[swift-evolution] repeat loop enhancement

Brent Royal-Gordon brent at architechies.com
Wed Dec 9 15:18:52 CST 2015


>> for x in 1...5 {
>> 	… some code…
>> }
> 
> for x in 1…5 - what does 1 … 5 mean? What does it mean for x to be in 1 … 5? Now you tell me x isn’t in 1 … 5 and I can replace x with _ what does it mean for _ to be in 1 … 5 and why do I need _ at all? _ isn’t in the loop either. What’s a loop?

You know, I look at this and wonder, why can’t you just say `for 1…5`?

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list