<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Sorry, my example should have been the other way around:<div class=""><br class=""></div><div class="">var data: NSData!</div><div class="">for 1...5 {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>data = self.loadSomeData()&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if data != nil {<br class=""><span class="Apple-tab-span" style="white-space:pre">                </span>break // *this* can't be done with .forEach<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>/// Try again in next iteration<br class="">}</div><div class=""><br class=""></div><div class="">if data == nil {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return</div><div class="">}</div><div class=""><br class=""></div><div class="">/// Process data.</div><div class=""><br class=""></div><div class="">But yeah, it can be written the other way around to avoid break.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 5, 2016, at 6:13 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">`continue` can be rewritten `return` inside `forEach`.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Jul 5, 2016 at 02:30 Charlie Monroe via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Example:<div class=""><br class=""></div><div class="">for 1...5 {</div><div class=""><span style="white-space:pre-wrap" class="">        </span>guard let data =&nbsp;self.loadSomeData() else {</div><div class=""><span style="white-space:pre-wrap" class="">                </span>/// Will try it several times and then report failure to the user.</div><div class=""><span style="white-space:pre-wrap" class="">                </span>continue</div><div class=""><span style="white-space:pre-wrap" class="">        </span>}</div><div class=""><span style="white-space:pre-wrap" class="">        </span></div><div class=""><span style="white-space:pre-wrap" class="">        </span>// process data</div><div class=""><span style="white-space:pre-wrap" class="">        </span>return</div><div class="">}</div><div class=""><br class=""></div><div class="">// Error, failed to load data even after retrying.</div></div><div style="word-wrap:break-word" class=""><div class=""><br class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 5, 2016, at 9:23 AM, Jose Cheyo Jimenez &lt;<a href="mailto:cheyo@masters3d.com" target="_blank" class="">cheyo@masters3d.com</a>&gt; wrote:</div><br class=""><div class=""><div dir="auto" class=""><div class=""></div><div class="">How would you build a condition to break if you are ignoring each value ? Unless you are hard coding a condition in which case I would still argue that the proposed shorthand for is less clear than `for _ in` or forEach.&nbsp;</div><div class=""><br class="">On Jul 4, 2016, at 9:29 PM, Charlie Monroe &lt;<a href="mailto:charlie@charliemonroe.net" target="_blank" class="">charlie@charliemonroe.net</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class="">-1 this is why we have collection.forEach{}<br class=""><div class=""><div dir="auto" class=""><div class=""><br class=""></div><div class="">(1...10).forEach {</div><div class="">// do something.&nbsp;</div><div class="">}</div></div></div></blockquote><div class=""><br class=""></div><div class="">This is not equivalent since it doesn't allow you to break from the for loop.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class="">On Jul 1, 2016, at 12:38 AM, Diego Barros via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_default"><font face="monospace, monospace" class="">When you want a simple `for` loop, for example:</font></div><div class="gmail_default"><font face="monospace, monospace" class=""><br class=""></font></div><div class="gmail_default"><p class=""><font face="monospace, monospace" class=""><span class="">for</span><span class=""> </span><span class="">_</span><span class=""> </span><span class="">in</span><span class=""> </span><span class="">1</span><span class="">...</span><span class="">10</span><span class=""> {</span></font></p>
</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class="gmail_default"><p class=""><font face="monospace, monospace" class="">// do something 10 times</font></p></div></blockquote><div class="gmail_default"><p class=""><font face="monospace, monospace" class="">}</font></p><p class=""><font face="monospace, monospace" class=""><br class=""></font></p><p class=""><font face="monospace, monospace" class="">Clean-up and simplify the syntax by removing the&nbsp;superfluous&nbsp;underscore and `in`:</font></p><p class=""><font face="monospace, monospace" class=""><br class=""></font></p><p class=""><font face="monospace, monospace" class=""><span class="">for</span><span class=""> </span><span class="">1</span><span class="">...</span><span class="">10</span><span class=""> {</span></font></p></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class="gmail_default"><p class=""><font face="monospace, monospace" class="">// do something 10 times</font></p></div></blockquote><div class="gmail_default"><div class="">









<br class=""></div><p class=""><span class=""><font face="monospace, monospace" class="">}</font></span></p></div><div class=""><div data-smartmail="gmail_signature" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><font face="monospace, monospace" class=""><br class=""></font><div class=""><font face="monospace, monospace" class="">-- diego</font></div></div></div></div></div></div>
</div>
</div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></div></div>_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>