title: scala newbie having troubles with Option, what's the equivalent of the ternary operator
body: <p>I've already read that the if statement in scala always returns an expression</p>
  
  <p>So I'm trying to do the following (pseudo code)</p>
  
  <pre><code>sql = "select * from xx" + iif(order.isDefined, "order by " order.get, "")
  </code></pre>
  
  <p>I'm trying with</p>
  
  <pre><code>val sql: String = "select * from xx" + if (order.isDefined) {" order by " + order.get} else {""} 
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>illegal start of simple expression
  </code></pre>
  
  <p>order is an Option[String]</p>
  
  <p>I just want to have an optional parameter to a method, and if that parameter (in this case order) is not passed then just skip it</p>
  
  <p>what would be the most idiomatic way to achieve what I'm trying to do?</p>
  
  <p>-- edit --</p>
  
  <p>I guess I hurried up too much to ask</p>
  
  <p>I found this way,</p>
  
  <pre><code>val orderBy = order.map( " order by " + _ ).getOrElse("")
  </code></pre>
  
  <p>Is this the right way to do it?</p>
  
  <p>I thought map was meant for other purposes...</p>