title: Variable assignment in an "if" condition
body: <p>I recently just lost some time figuring out a bug in my code which was caused by a typo:</p>
  <pre><code>if (a=b)
  </code></pre>
  <p>instead of:</p>
  <pre><code>if (a==b)
  </code></pre>
  <p>I was wondering if there is any particular case you would want to assign a value to a variable in a <code>if</code> statement, or if not, why doesn't the compiler throw a warning or an error?</p>