<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Rationale:</div>
<div> </div>
<div>Swift's For-In-loop is fine, as long as you don't need an iteration step size other than 1/-1, in which case it becomes unexpectedly inconsistent and unwieldy.</div>
<div> </div>
<div>for i in 1...10<br/>
for i in reverse(10...1)<br/>
for i in stride(from:1, through:10, by:3)<br/>
or even<br/>
for i in 1.stride(through:10, by:3)</div>
<div> </div>
<div>The above sequence is not only confusing for teaching purposes/beginners (first lesson: protocols. really?), but also unnecessarily bulky for everyday use. It's a For-loop, one of the most basic and frequently used structures in any language -- please let's make it pithy.</div>
<div> </div>
<div><br/>
Comparison:</div>
<div> </div>
<div>Currently, even the C-style For-loop we are just about to get rid of could be argued to be more concise and consistent, but significantly more so are the likes of</div>
<div> </div>
<div># Python<br/>
for i in range(1, 10, 3):</div>
<div> </div>
<div>-- Lua<br/>
for i = 1, 10, 3</div>
<div> </div>
<div>' Basic<br/>
for i = 1 to 10 step 3</div>
<div> </div>
<div>(* Modula-2 *)<br/>
for i := 1 to 10 by 3</div>
<div> </div>
<div>// Chapel<br/>
for i in 1..10 by 3</div>
<div> </div>
<div>or any other remotely relevant non-C-style language that allows For-loops with an altered step size.</div>
<div> </div>
<div>While there are other issues like having to use reverse(1...10) instead of simply 10...1, (which compiles, but doesn't run, even when using literals -- why?) none of it goes against the grain as much as being forced to type out stride(boiboiboilerplate) for a simple iteration.</div>
<div> </div>
<div><br/>
Suggestion(s):</div>
<div> </div>
<div>A) Add keyword "by" as syntactic sugar, used as in Modula/Chapel (and tip our hat to Algol 68):</div>
<div> </div>
<div>// Swift<br/>
for i in 1...10 by 3<br/>
for i in reverse(1...10) by -3</div>
<div> </div>
<div>or even better yet (if feasible):</div>
<div> </div>
<div>B)</div>
<div>for i in 1...10 by 3<br/>
for i in 10...1 by -3</div>
<div><br/>
Please comment, and thanks everyone for reading.</div>
<div> </div>
<div>-- Hans</div>
<div> </div>
</div></div></body></html>