title: Java - myVar cannot be resolved to a variable
body: <pre><code>while (someCondition) {
      double myVar = someFunc(); // someFunc returns 41
  
      if (myVar &gt; 0) {
       String precision ="##";
       DecimalFormat df = new DecimalFormat("0."+precision);
       // breakpoint set on next line
       double myVarPercentage = Double.parseDouble(df.format((myVar/50)*100));
      }
  }
  </code></pre>
  
  <p>When I look at the value of myVar via eclipse it states it cannot be resolved to a variable despite someFunc() resolving to 41. The above fragment is executing inside a loop inside an instance method and there are no other variables in scope entitled 'myVar'. </p>
  
  <p>Do I have to declare the double outside the loop?</p>