Why am I getting error?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2693138/variable-scope-in-statement-blocks">variable scope in statement blocks</a>  </p>
</blockquote>



<p>I have following code snippet in c#,but is's not working</p>

<pre><code> static void Main(string[] args)
        {
            if (true)
            {
                string name = "test";
            }
            else
            {
                string name = "hello";
            }
            string name = "world";
        }
</code></pre>

<p>It gives me an error saying that 'name' is already declared in the last line, but if I change it for <code>'name = "some string"</code> says that the variable name is not declared. </p>
