title: When changing a variable within if / else block an error says it is unassigned
body: <p>I am trying to change the color of a ball randomly however when I try to use the color variable to become the color of the solid brush it says that it is unassigned.  "Use of unassigned local variable 'ballColour'"</p>
  
  <pre><code>    xPos = xPos + GAP_SIZE;
      int colour = rand.Next(1, 40);
      Color ballColour;
      if (colour &gt;= 1 &amp;&amp; colour &lt;= 9)
      {
          ballColour = Color.Blue;
      }
      else if (colour &gt;= 10 &amp;&amp; colour &lt;= 19)
      {
          ballColour = Color.Orange;
      }
  
      else if (colour &gt;= 20 &amp;&amp; colour &lt;= 29)
      {
          ballColour = Color.Green;
      }
      else if (colour &gt;= 30 &amp;&amp; colour &lt;= 39)
      {
          ballColour = Color.Red;
      }
      else if (colour == 40)
      {
          ballColour = Color.Purple;
      }
      SolidBrush ballColourBrush = new SolidBrush(ballColour); //This is the one that returns the error.
      paper.FillEllipse(ballColourBrush, xPos, yPos, BALL_SIZE, BALL_SIZE);
                      xPos = xPos + BALL_SIZE;
  </code></pre>