title: Variable does not exist in current context
body: <p>I'm trying to run a while loop that keeps going through a list until the entry is null. My code looks like so:</p>
  
  <pre><code>int i = 0;
  
  while(list[i] != null)
  {
  
      &lt;dl class="dl-horizontal"&gt;
          &lt;dt&gt;
              list[i].Name
          &lt;/dt&gt;
  
          &lt;dd&gt;
              list[i].Damage
          &lt;/dd&gt;
      &lt;/dl&gt;
      i++;
  }
  </code></pre>
  
  <p>The error I'm getting is that <code>i</code> doesn't exist in the context of the while loop. I can't define it inside of the loop because then it will be reset to 0 on each pass through yet I'm not sure what else to do.</p>