title: Kotlin - conditional assign value in one line
body: <p>Is it possible to conditional assign a value in one line in kotlin?</p>
  <p><strong>Setup</strong></p>
  <pre><code>var foo: String
  
  if (x != 0) {
    foo = x
  }
  </code></pre>
  <p><strong>Goal</strong></p>
  <pre><code>// nothing is set if condition is false
  foo = if (x != 0) x
  </code></pre>
  <p><strong>Not wanted</strong></p>
  <pre><code>// null is set if condition is false
  foo = takeIf{ x != 0 }.let{ x }
  </code></pre>