[swift-evolution] Feature proposal: Range operator with step

Hans Huck gutgedacht at gmx.de
Thu Apr 14 14:42:11 CDT 2016


Dave Abrahams via swift-evolution <swift-evolution at ...> writes:

> 
> If I thought extreme concision was important for this application, I'd be
> proposing something like 
> 
>   for x in 0.0..<20.0//1.3 {}
> 
> but personally, I don't,
>
And that is why exactly? The For-loop is at the very core of the language
and one of its most frequently used structures. Any unnecessary noise should
be avoided here.

> which is why I propose `.striding(by: x)`
> rather than simply `.by(x)`, the latter being more open to
> misinterpretation.
> 
Please elaborate. How could

for i in (1...10).by(3)

possibly be misinterpreted?

-- Hans



More information about the swift-evolution mailing list