<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=""><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">The current ternary operator, for this example:&nbsp;<br class=""><br class=""></font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">let&nbsp;val =&nbsp;p&nbsp;==&nbsp;5&nbsp;?&nbsp;10&nbsp;:&nbsp;40&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br class=""><br class="">Which I have always thought was hard to read but I do like the functionality it provides. That is, in one expression you can compactly get two different values based upon a condition. Swift seems to have&nbsp;adopted the C style ternary operators probably to not completly change everytihg. Similar to the drop of the ++&nbsp;and -- operator I am proposing that there is to replace the ternary operator to improve readability but&nbsp;continue to provide that functionality. &nbsp;</font></div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">Recommendation: most readable but changes rules about if-else always having braces and puts the&nbsp;“if” at end.&nbsp;</font><span class="" style="font-family: Menlo;">It is only a little bit longer than the original.&nbsp;</span><font face="Menlo" class="">I&nbsp;think it is clearer to have the conditional at the end so the&nbsp;assignment part is where the&nbsp;variable is assigned. This also does not introduce new&nbsp;keywords or operators.&nbsp;</font></div><div class=""><span class="" style="font-family: Menlo;"><br class=""></span></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">let&nbsp;</font><span class="" style="font-family: Menlo;">val</span><font face="Menlo" class="">&nbsp;=&nbsp;10&nbsp;else&nbsp;40&nbsp;if&nbsp;p&nbsp;==&nbsp;5</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class=""><br class="">In looking at the Nil-Coalescing&nbsp;operator there is a similar idea but it is really not the same. In that the left hand side of the&nbsp;??&nbsp;operator&nbsp;returns&nbsp;itself when non nil, and the behavior of the ternary&nbsp;operator is different. It is also harder to read.&nbsp;<br class=""><br class="">let&nbsp;</font><span class="" style="font-family: Menlo;">val</span><font face="Menlo" class="">&nbsp;=&nbsp;10&nbsp;??&nbsp;40&nbsp;if&nbsp;p =&nbsp;5<br class=""><br class="">I also&nbsp;considered a bunch&nbsp;of other&nbsp;possibilities&nbsp;like using “where" or “when" instead of&nbsp;“if”, the python of putting conditional in the middle or the ruby style of “if" returning a value but did not like those.&nbsp;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class=""><br class=""></font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">// python style</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">let &nbsp;val = 10 if p == 5 else 40&nbsp;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class=""><br class=""></font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">// ruby style</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="">let val = if p == 5 then 10 else 40 &nbsp;</font></div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class=""><br class=""></font></div></body></html>