title: Use of unassigned local variable?
body: <p>Visual Studio keeps saying <code>Use of unassigned variable</code> for <code>iVal</code> and <code>iNumber</code>. Can anyone tell me where I'm going wrong? </p>
  
  <p>This is designed to be a code to ask the user to keep entering integers and adding them up until the user wants to stop.  The sum of the integers is then displayed on the console.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace AddFive
  {
      class Program
      {
          static void Main(string[] args)
          {
             int iNumber;
             int iVal;
             int iTotal = 0;
  
              while (iVal &gt; 0)
              {
                  Console.WriteLine("Enter number " + iNumber);
                  iVal = Convert.ToInt32(Console.ReadLine());
                  iTotal = iTotal + iVal;
              }
  
              if (iNumber &lt;= 0)
              {
                  Console.WriteLine("Total = " + iTotal);
                  iVal = Convert.ToInt32(Console.ReadLine());
                  iTotal = iTotal + iVal;
              }
  
              Console.WriteLine("Total = " + iTotal);
              Console.WriteLine();
              Console.WriteLine("Press any key to close");
              Console.ReadKey();
          }
      }
  }
  </code></pre>