[swift-evolution] For-loop revisited

Erica Sadun erica at ericasadun.com
Tue Mar 8 18:43:37 CST 2016


> On Mar 8, 2016, at 5:33 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Tue Mar 08 2016, Maximilian Hünenberger <swift-evolution at swift.org> wrote:
> 
>> Actually you cannot use the global stride function anymore.
>> I thought a method on "Range" which returns a stride would be easier to grasp:
>> 
>> for x in 0.stride(to: 0.5, by: 0.03) { ... }
>> 
>> // much faster to predict what is does even though it is less clear to a beginner
>> for x in (0 ... 0.5).by(0.03) { ... }
> 
> Frankly I find the free function to be much more readable than either of these.

I am really happy to welcome it back.

-- E



More information about the swift-evolution mailing list