title: Cannot be resolved to a variable, after asking user to input variable
body: <p>It's probably something obvious, but when I'm trying to force the user to keep entering a value until he enters a valid value, I get an error that the variable cannot be resolved.</p>
  
  <p>Then if I declare it beforehand I get an error saying duplicate value. </p>
  
  <pre><code>do {
      float x = Float.parseFloat(javax.swing.JOptionPane.showInputDialog("Enter 1");
  } while (x != 1);
  </code></pre>
  
  <p>Isn't the compiler supposed to execute the <code>do</code> statement first, before worrying about the <code>while</code>?</p>