title: Why would you use an assignment in a condition?
body: <p>In many languages, assignments are legal in conditions. I never understood the reason behind this. Why would you write:</p>
  <pre><code>if (var1 = var2) {
    ...
  }
  </code></pre>
  <p>instead of:</p>
  <pre><code>var1 = var2;
  if (var1) {
    ...
  }
  </code></pre>
  <p>?</p>