<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">How often have you written something like the following?<div class=""><br class=""></div><div class="">`</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> indexPath.row == </span><span style="font-variant-ligatures: no-common-ligatures; color: #7373ff" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">guard</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> thing = things[index] </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">else</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">return nil</span><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div></div><div class="">`</div><div class=""><br class=""></div><div class="">I propose adding some syntactic sugar to make such statements more readable and simple to write:</div><div class=""><br class=""></div><div class="">`</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> indexPath.row == </span><span style="font-variant-ligatures: no-common-ligatures; color: #7373ff" class="">0</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">nil</span><span style="font-variant-ligatures: no-common-ligatures" class=""> <span style="color: rgb(181, 27, 71);" class="">unless</span> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b51b47" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> thing = things[</span><span style="font-variant-ligatures: no-common-ligatures; color: #cc4428" class="">index</span><span style="font-variant-ligatures: no-common-ligatures" class="">]</span></div></div><div class="">`</div><div class=""><br class=""></div><div class="">I don’t know how easy or hard this would be to implement, but I think it would improve some code significantly.</div><div class=""><br class=""></div><div class="">–Julian Dunskus</div></body></html>