title: Variable declaration not allowed here, used in if statement
body: <p>After typing that first part of the if statement, I was going to use the next line to declare a variable (costPerCD) but I'm told "Variable declaration is not allowed here." I'm not sure how else to calculate the costPerCD without using this method. This is an example of what I'm trying to do. Any help would be appreciated.</p>
  
  <pre><code>    if ((numCDs&gt;=1 &amp;&amp; (numCDs&lt;=4))
      double costPerCD= 20.99;
  </code></pre>