[swift-evolution] A (better) Swift Equivalent For The Classical For-Loop With Numeric Scalars

Brent Royal-Gordon brent at architechies.com
Wed Mar 23 23:01:53 CDT 2016


> Speaking of where, why wouldn’t you just do:
> 
> 	for eachElement in theIntegerSequence where eachElement < 5 { … }

The `while` clause in the example we discussed was testing a separate variable which was being used to count the number of matches. Thus, it was playing the role of `prefix` (but in a less understandable way).

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list