<div dir="ltr">What if we left the if { ...} else { ... } syntax alone (as a statement), and updated the ternary expression to be a more general pattern matching expression (closer to &quot;switch&quot;)? Something like<div><br></div><div>let x = condition ?</div><div>   true: &quot;Hello&quot;</div><div>   false: &quot;Goodbye&quot;</div><div><br></div><div>let x = optionalValue ?</div><div>   .Some(let unwrapped): &quot;Hello, \(unwrapped)&quot;</div><div>   .None: &quot;To Whom It May Concern&quot;</div><div><br></div><div>let myFavoriteColor = yourFavoriteColor ?</div><div>    .Blue: .Red</div><div>    .Green: .Blue</div><div>    .Red: .Green</div><div><br></div><div>let quadrant = (x, y) ?</div><div>    let (x, y) where x &lt; 50 &amp;&amp; y &lt; 50: &quot;top left&quot;</div><div>    let (x, y) where x &lt; 50 &amp;&amp; y &gt; 50: &quot;bottom left&quot;</div><div>    let (x, y) where x &gt; 50 &amp;&amp; y &lt; 50: &quot;top right&quot;</div><div>    default: &quot;bottom right&quot;</div><div><br></div><div>The colon comes from the fact that this is sort of a light-weight expression-based &quot;switch&quot; statement, where each branch can only contain an expression, not a series of statements.</div><div><br></div><div>This is very similar to pattern matching expressions in languages like Haskell, ML, and Coq.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 6, 2015 at 11:25 AM, Thorsten Seitz <span dir="ltr">&lt;<a href="mailto:thorsten.seitz@web.de" target="_blank">thorsten.seitz@web.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div>Am 06.12.2015 um 01:28 schrieb Alex Lew via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;:</div><br><div><div dir="ltr">I don&#39;t think you can just get rid of the if statement in favor of an expression. You still want to be able to do this:<div><br></div><div>if (condition) {</div><div>    funcWithSideEffectsThatReturnsInt()</div><div>} else {</div><div>    funcWithSideEffectsThatReturnsString()</div><div>}</div><div><br></div><div>but that&#39;s not a valid expression (what is its type?).</div></div></div></blockquote><div><br></div></span><div>That would actually be no problem if Swift’s type system would have union types (Ceylon has union and intersection types which are quite awesome and enable lots of nice things quite naturally, see <a href="http://ceylon-lang.org/documentation/1.2/tour/types/" target="_blank">http://ceylon-lang.org/documentation/1.2/tour/types/</a>).</div><div><br></div><div>In that case the type of such an expression would just be the union of both types, which is written <font face="Courier">Int | String</font> in Ceylon.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Thorsten</div></font></span></div><br></div></blockquote></div><br></div>