title: Can "when" also accept an expression?
body: <p>kotlin noob here. This is a sample code from kotlin's site</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      val language = if (args.size == 0) "EN" else args[0]
      println(when (language) {
          "EN" -&gt; "Hello!"
          "FR" -&gt; "Salut!"
          "IT" -&gt; "Ciao!"
          else -&gt; "Sorry, I can't greet you in $language yet"
      })
  }
  </code></pre>
  
  <p>Now if I modify the above code into the following:</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      println(when (if (args.size == 0) "EN" else args[0]) {
          "EN" -&gt; "Hello!"
          "FR" -&gt; "Salut!"
          "IT" -&gt; "Ciao!"
          else -&gt; "Sorry, I can't greet you in $language yet"
      })
  }
  </code></pre>
  
  <p>I get an error. Why? Isn't <code>when</code> supposed to also accept an expression? In this case the result of the <code>if</code> condition?</p>
  
  <p>P.S I tried this in <a href="https://try.kotlinlang.org/" rel="nofollow noreferrer">https://try.kotlinlang.org/</a> And the error I get is just a simple <code>error:</code> with no further explanation</p>