<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="">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="">&nbsp;</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 5, 2015, at 7:02 AM, J. Cheyo Jimenez &lt;<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><font size="2" class=""><span style="background-color:rgba(255,255,255,0)" class="">Hi Sergey,</span></font><div class=""><font size="2" class=""><span style="background-color:rgba(255,255,255,0)" class=""><br class=""></span></font></div><div class=""><font size="2" class=""><span style="background-color:rgba(255,255,255,0)" class="">Are you thinking on writing the formal proposal for the if expression?&nbsp;</span></font></div><div class=""><font size="2" class=""><span style="background-color:rgba(255,255,255,0)" class=""><br class=""></span></font></div><div class=""><font size="2" style="background-color:rgba(255,255,255,0)" class=""><a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000165.html" target="_blank" style="background-color:rgba(255,255,255,0)" class="">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 &lt;<a href="mailto:s.pepyakin@gmail.com" class="">s.pepyakin@gmail.com</a>&gt; wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc 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="">
&nbsp;message = "x is even"<br class="">
} else {<br class="">
&nbsp;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 href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')" 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" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>