`continue` can be rewritten `return` inside `forEach`.<br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 5, 2016 at 02:30 Charlie Monroe via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></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">Example:<div><br></div><div>for 1...5 {</div><div><span style="white-space:pre-wrap">        </span>guard let data = self.loadSomeData() else {</div><div><span style="white-space:pre-wrap">                </span>/// Will try it several times and then report failure to the user.</div><div><span style="white-space:pre-wrap">                </span>continue</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>// process data</div><div><span style="white-space:pre-wrap">        </span>return</div><div>}</div><div><br></div><div>// Error, failed to load data even after retrying.</div></div><div style="word-wrap:break-word"><div><br><div><div><blockquote type="cite"><div>On Jul 5, 2016, at 9:23 AM, Jose Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" target="_blank">cheyo@masters3d.com</a>> wrote:</div><br><div><div dir="auto"><div></div><div>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. </div><div><br>On Jul 4, 2016, at 9:29 PM, Charlie Monroe <<a href="mailto:charlie@charliemonroe.net" target="_blank">charlie@charliemonroe.net</a>> wrote:<br><br></div><blockquote type="cite"><div><div><blockquote type="cite">-1 this is why we have collection.forEach{}<br><div><div dir="auto"><div><br></div><div>(1...10).forEach {</div><div>// do something. </div><div>}</div></div></div></blockquote><div><br></div><div>This is not equivalent since it doesn't allow you to break from the for loop.</div><br><blockquote type="cite"><div><div dir="auto"><div><br>On Jul 1, 2016, at 12:38 AM, Diego Barros via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_default"><font face="monospace, monospace">When you want a simple `for` loop, for example:</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><p><font face="monospace, monospace"><span>for</span><span> </span><span>_</span><span> </span><span>in</span><span> </span><span>1</span><span>...</span><span>10</span><span> {</span></font></p>
</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default"><p><font face="monospace, monospace">// do something 10 times</font></p></div></blockquote><div class="gmail_default"><p><font face="monospace, monospace">}</font></p><p><font face="monospace, monospace"><br></font></p><p><font face="monospace, monospace">Clean-up and simplify the syntax by removing the superfluous underscore and `in`:</font></p><p><font face="monospace, monospace"><br></font></p><p><font face="monospace, monospace"><span>for</span><span> </span><span>1</span><span>...</span><span>10</span><span> {</span></font></p></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default"><p><font face="monospace, monospace">// do something 10 times</font></p></div></blockquote><div class="gmail_default"><div>
<br></div><p><span><font face="monospace, monospace">}</font></span></p></div><div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font face="monospace, monospace"><br></font><div><font face="monospace, monospace">-- diego</font></div></div></div></div></div></div>
</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></blockquote></div></div></blockquote></div><br></div></div></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>