<font size="2"><span style="background-color:rgba(255,255,255,0)">Hi Sergey,</span></font><div><font size="2"><span style="background-color:rgba(255,255,255,0)"><br></span></font></div><div><font size="2"><span style="background-color:rgba(255,255,255,0)">Are you thinking on writing the formal proposal for the if expression? </span></font></div><div><font size="2"><span style="background-color:rgba(255,255,255,0)"><br></span></font></div><div><font color="#000000" size="2" style="background-color:rgba(255,255,255,0)"><a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000165.html" target="_blank" style="background-color:rgba(255,255,255,0)">https://lists.swift.org/pipermail/swift-evolution/2015-December/000165.html</a></font></div><div><br></div><br>On Friday, December 4, 2015, Sergey Shulepov &lt;<a href="mailto:s.pepyakin@gmail.com">s.pepyakin@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello.<br>
<br>
It would be cool if control flow statements like &quot;switch&quot;, &quot;if&quot; can be used as expressions, such as in languages like Scala, Rust and Kotlin,<br>
so instead of writing:<br>
<br>
var message: String<br>
if x % 2 == 0 {<br>
 message = &quot;x is even&quot;<br>
} else {<br>
 message = &quot;x is odd&quot;<br>
}<br>
<br>
you can write:<br>
<br>
let message: String = if x % 2 == 0 { &quot;x is even&quot; } else { &quot;x is odd&quot; }<br>
<br>
I&#39;m not into any kind of compiler development, and don&#39;t know is it feasible to introduce such change at the moment, but at least, I would like to hear why not.<br>
Thanks!<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;swift-evolution@swift.org&#39;)">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>
</blockquote>