<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="">The ternary operator is indeed equivalent to an if expression but:</div><div class=""><br class=""></div><div class="">1) There is no equivalent for switch.</div><div class="">2) There is also a proposition to remove the ternary operator in favour of a if expression.</div><div class=""><br class=""></div><div class="">David.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 05 Dec 2015, at 16:41, Jonathan Hull <<a href="mailto:jhull@gbis.com" class="">jhull@gbis.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Sorry, that should be:</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">let message:String = (x % 2 == 0) ? “x is even” : “x is odd”</div></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 5, 2015, at 7:35 AM, Jonathan Hull <<a href="mailto:jhull@gbis.com" class="">jhull@gbis.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">Don’t we already have the following?</div><div class=""><br class=""></div><div class="">let message:String = (x % 2) ? “x is even” : “x is odd"</div><div class=""> </div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 5, 2015, at 7:02 AM, J. Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><font size="2" class=""><span class="" style="background-color: rgba(255, 255, 255, 0);">Hi Sergey,</span></font><div class=""><font size="2" class=""><span class="" style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><font size="2" class=""><span class="" style="background-color: rgba(255, 255, 255, 0);">Are you thinking on writing the formal proposal for the if expression? </span></font></div><div class=""><font size="2" class=""><span class="" style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><font size="2" class="" style="background-color: rgba(255, 255, 255, 0);"><a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000165.html" target="_blank" class="" style="background-color: rgba(255, 255, 255, 0);">https://lists.swift.org/pipermail/swift-evolution/2015-December/000165.html</a></font></div><div class=""><br class=""></div><br class="">On Friday, December 4, 2015, Sergey Shulepov <<a href="mailto:s.pepyakin@gmail.com" class="">s.pepyakin@gmail.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Hello.<br class=""><br class="">It would be cool if control flow statements like "switch", "if" can be used as expressions, such as in languages like Scala, Rust and Kotlin,<br class="">so instead of writing:<br class=""><br class="">var message: String<br class="">if x % 2 == 0 {<br class=""> message = "x is even"<br class="">} else {<br class=""> message = "x is odd"<br class="">}<br class=""><br class="">you can write:<br class=""><br class="">let message: String = if x % 2 == 0 { "x is even" } else { "x is odd" }<br class=""><br class="">I'm not into any kind of compiler development, and don't know is it feasible to introduce such change at the moment, but at least, I would like to hear why not.<br class="">Thanks!<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a 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=""></blockquote><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=vmG20pDvfvCvG17-2BDXZuJApc3THJp39lz-2FZidkU6fCBUXRXLzBsan0cSLS3lMadQWMRSVNmf4KVWR8hmcNF3A5u-2B85uhXqFjgP-2Ft5clr9NGUsRT-2Fau16GOtofCs-2BF-2FlGD-2BJ1YsT8F98A-2Bg9u-2F2u80HFxYmfX98nLG7O-2Fb6gLO2OTHm2K4RbMQZ5pziTrc9QEHxghu-2B4X3dkKZel-2Fnq2DtQ-3D-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"><span class="Apple-converted-space"> </span>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=vmG20pDvfvCvG17-2BDXZuJIoGndLRc9-2B7h08n9O7rRDedttLTOZ2OkWCQh9Kdv14k60DgF7uPe7CnfTN-2BiAE8lE8-2BbbM7bPmDw-2Bs8z6t-2B-2F8P31x0kPfmvsaMOtkPr6k1Iw8-2Fy4XVTQgB84RDD7cAT4Iru13mcQzNGsAf2BQ1tilDUmha7NuVK3ddafunwZcKNCGc40vxLYU1nWqkeTcYG4A-3D-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=nE9rxSXA5G4kxsTVkgv43hXwizS3O2z60WweqomIrdhLdtk7upL43OItN5rli89TmDgJ3LVrPSHwKOyB6-2BO3RbIAQJeEn9H7K71Hns2Vf7pruSi5SDMCq82vEKwFd3noA788LbhsqfoCqi9hGfL4ZmYkOmkPywnVIH158Z-2Ffzj5mq4joKTljX8aPqQTh7T2HgOIQcq-2BwN0Y38fXdC4sFc683I19BKqSSTNwnLyQO-2FhU-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>