Variable declaration warning in VS2008
<p>The following code in VS2008 gives me a "variable is already defined" warning:</p>

<pre><code>if (someVar) {
  var a = 1;
}
else {
  var a = 2;
}
</code></pre>

<p>The warning is given on the second <code>var a = ...</code>. To cure this warning I have done:</p>

<pre><code>var a;
if (someVar) {
  a = 1;
}
else {
  a = 2;
}
</code></pre>

<p>But is this the correct way to do it?</p>

<p>Thanks,</p>

<p>AJ</p>
