title: Scala assign inside an if condition
body: <pre><code>val flag = false
  
  if (val data = flag) {
    println(data)
  }
  </code></pre>
  
  <p>Is it possible to assign the <code>flag</code> inside a if statement and get evaluated automatically in Scala?</p>