title: Initialization variable inside if
body: <p>Hi we can not define in c# variable like this</p>
  
  <pre><code>if((var input = db.table.FirstOrDefault()) != null)
  {
     // and here I could use my 'input' variable
  }
  </code></pre>
  
  <p>but i can do it this way</p>
  
  <pre><code>for(var input = db.table.FirstOrDefault(); input != null; input = null)
  {
    //opeartion
  
  }
  </code></pre>
  
  <p>Can anyone tell me why? Woudn't that be nice if we could do it using if ?</p>