<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym18_1_1458743649954_4828">Some code :</div><div id="yui_3_16_0_ym18_1_1458743649954_4828"><br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828">WAS:</div><div id="yui_3_16_0_ym18_1_1458743649954_4828">&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;</div><div id="yui_3_16_0_ym18_1_1458743649954_4828">var i:Int = 0</div><div id="yui_3_16_0_ym18_1_1458743649954_4828">for (i=0;i&lt;len;i++)</div><div id="yui_3_16_0_ym18_1_1458743649954_4828">{</div><div id="yui_3_16_0_ym18_1_1458743649954_4828">&nbsp; &nbsp; //do something</div><div id="yui_3_16_0_ym18_1_1458743649954_4828">}</div><div id="yui_3_16_0_ym18_1_1458743649954_4828"><br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828">....</div><div id="yui_3_16_0_ym18_1_1458743649954_4828"><br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="">for (i=0;i&lt;len;i++)</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="">{</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr">&nbsp; &nbsp; if something is true</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr">&nbsp; &nbsp; {<br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr">&nbsp; &nbsp; &nbsp; &nbsp; break</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr">&nbsp;&nbsp;&nbsp;&nbsp;}<br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="">}</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class=""><br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="">use i</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class=""><br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="">&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;</div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class=""><br id="yui_3_16_0_ym18_1_1458743649954_4983" class=""></div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class="">Now without C style for</div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class="">after mechanically repair the code</div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class=""><br></div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class="">I get this</div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class=""><br></div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class="">var i:Int = 0</div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class=""><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class="">for i in (0..&lt;len)</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class="">{</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class="">&nbsp; &nbsp; //do something</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class="">}</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class=""><br id="yui_3_16_0_ym18_1_1458743649954_5492" class=""></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class="">....</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" style="margin-top: 0.1em; margin-bottom: 0.1em;" class=""><br id="yui_3_16_0_ym18_1_1458743649954_5496" class=""></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" style="margin-top: 0.1em; margin-bottom: 0.1em;" dir="ltr">for i in (0..&lt;len)<br id="yui_3_16_0_ym18_1_1458743649954_5569" class=""></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" style="margin-top: 0.1em; margin-bottom: 0.1em;">{</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr" style="margin-top: 0.1em; margin-bottom: 0.1em;">&nbsp; &nbsp; if something is true</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr" style="margin-top: 0.1em; margin-bottom: 0.1em;">&nbsp; &nbsp; {<br id="yui_3_16_0_ym18_1_1458743649954_5502" class=""></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr" style="margin-top: 0.1em; margin-bottom: 0.1em;">&nbsp; &nbsp; &nbsp; &nbsp; break</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" dir="ltr" style="margin-top: 0.1em; margin-bottom: 0.1em;">&nbsp;&nbsp;&nbsp;&nbsp;}<br id="yui_3_16_0_ym18_1_1458743649954_5506" class=""></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" style="margin-top: 0.1em; margin-bottom: 0.1em;">}</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" style="margin-top: 0.1em; margin-bottom: 0.1em;"><br id="yui_3_16_0_ym18_1_1458743649954_5510" class=""></div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" style="margin-top: 0.1em; margin-bottom: 0.1em;" dir="ltr">use i ??</div><div id="yui_3_16_0_ym18_1_1458743649954_4828" class="" style="margin-top: 0.1em; margin-bottom: 0.1em;" dir="ltr">What is i now :) &nbsp;!!!!</div></div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class=""><br></div><div dir="ltr" id="yui_3_16_0_ym18_1_1458743649954_4981" class=""><br></div><div id="yui_3_16_0_ym18_1_1458743649954_4828">&nbsp;</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Wednesday, March 23, 2016 1:38 PM, Brent Royal-Gordon via swift-evolution &lt;swift-evolution@swift.org&gt; wrote:<br></font></div>  <br><br> <div class="y_msg_container">&gt; One advantage of the old C style for loop is that everything to do with loop control is in one place, usually on one line. There is currently no way of doing that for the (quite common) use case of iterating through a sequence until a particular condition (other than the end of the sequence) is true except by using a break. <br clear="none"><br clear="none">If you can stand using method chains, I believe that role would be filled by the `takeWhile(_:)` method that Kevin Ballard (IIRC) wants to add to Sequence. (Although `takeWhile(_:)` would be greedy by default.)<br clear="none"><br clear="none">But honestly, other than distaste, I don't see much of a practical issue with putting an `if` or `guard` on the first line with a `break` in it. That still clusters the iteration logic at the top of the loop, even if it's not quite in a single statement.<div class="yqt1731537147" id="yqtfd17353"><br clear="none"><br clear="none">-- <br clear="none">Brent Royal-Gordon<br clear="none">Architechies<br clear="none"><br clear="none">_______________________________________________<br clear="none">swift-evolution mailing list<br clear="none"><a shape="rect" ymailto="mailto:swift-evolution@swift.org" href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br clear="none"><a shape="rect" href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br clear="none"></div><br><br></div>  </div> </div>  </div></div></body></html>