<div dir="ltr">You can use `stride`:<div><br></div><div>for i in 0.stride(to: 10, by: 2) {</div><div>    print(&quot;i is \(i)&quot;)</div><div>}</div><div class="gmail_extra">
<br><div class="gmail_quote">On Tue, Dec 15, 2015 at 12:08 AM, Eirny Kwon via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><p style="margin:0px;font-size:12px;line-height:normal;font-family:&#39;Meslo LG M DZ&#39;"><span style="font-family:Helvetica,Arial;font-size:13px">for loop is working</span></p><div><span style="font-family:Helvetica,Arial;font-size:13px"><br></span></div><p style="margin:0px;font-size:12px;line-height:normal;font-family:&#39;Meslo LG M DZ&#39;"><span style="color:#bb2ca2">for</span> <span style="color:#bb2ca2">var</span> i = <span style="color:#272ad8">0</span>; i &lt; <span style="color:#272ad8">10</span>; i += <span style="color:#272ad8">2</span> {</p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:&#39;Meslo LG M DZ&#39;;color:rgb(209,47,27)"><span style="color:#000000">    </span><span style="color:#3d1d81">print</span><span style="color:#000000">(</span>&quot;i is <span style="color:#000000">\</span>(<span style="color:#000000">i</span>)&quot;<span style="color:#000000">)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:&#39;Meslo LG M DZ&#39;">}</p><div><br></div></div> <div><div><div class="h5"><br> <div><div style="font-family:helvetica,arial;font-size:13px"><span style="font-family:Helvetica,Arial">On December 15, 2015 at 5:05:41 PM, cooper liu via swift-users (</span><a href="mailto:swift-users@swift.org" style="font-family:Helvetica,Arial" target="_blank">swift-users@swift.org</a><span style="font-family:Helvetica,Arial">) wrote:</span></div></div> </div></div><blockquote type="cite"><span><div><div></div><div><div><div class="h5">






<div>Hi,</div>
<div>If the c style for loop was removed,how to implement the
following code beautifully:</div>
<div>For(var i=0; i &lt; 10; i+=2)</div>
<div>Since the range operator ... doesn&#39;t support step other than
1, and it doesn&#39;t support end value &lt; start value.</div>
<div><br></div>
<div>Thanks!</div>
<div>
<div><br></div>
<br></div>
</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=9xi1sqmKsCg9jKqAWTVX7BM9IbeqCt5n-2Bct01Y2bp-2FRexUSd2DSiI0VaQbhYV4Lvbl16Hy1FcaAl7HyjIb-2FV6GiqJCQ7m7vYrlByAx6CUIijFPKMOByg5311uGucL9fMWtisSdkHYLoox4uhWb55G9VnXjdi0VBjlrQUap73MFtZ8-2BkozrGuoKdATOeJpU-2BjCO008DNbd2XUbH4isRW6NNvzxiTLiLYJR8N81H66Acg-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">


_______________________________________________<br>swift-users mailing list<br><a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br></div></div></span></blockquote></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qy63Krvu9-2BIuVKT8Pc88CDU3FPuRlOMeORhea6rqTX5RQlR6osxfyymW-2F4d2afxfamqdPGiMERGuhoDkbDFEh3GbxwBKRGtvIcgn8BEitLuC1ZA5uG3ZlM33SQW8YYpKFGkAmdtw3xVsaGgoQzjYKOO6QQzvyTNfP5VloCMdw9LYRivumox4T664nl710FjStE-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div></div>