title: Variable declared in for-loop is local variable?
body: <p>I have been using C# for quite a long time but never realised the following:</p>
  
  <pre><code> public static void Main()
   {
       for (int i = 0; i &lt; 5; i++)
       {
  
       }
  
       int i = 4;  //cannot declare as 'i' is declared in child scope                
       int A = i;  //cannot assign as 'i' does not exist in this context
   }
  </code></pre>
  
  <p>So why can I not use the value of 'i' outside of the for block if it does not allow me to declare a variable with this name?</p>
  
  <p>I thought that the iterator variable used by a for-loop is valid only in its scope.</p>