title: While loop break condition
body: <p>I want to do some calculations with polygons. So I need the user to input some x and y coordinates. This is performed by the following code:</p>
  
  <pre><code>private static boolean isX = true;
  private static Scanner scanner = new Scanner(System.in);
  
  private static double readDouble() {
      double value = 0;
      System.out.print("Koordinate " + (isX ? "X" : "Y") + " : ");
      value = scanner.nextDouble();
      if (!isX)
          System.out.println("--------------------");
      isX = !isX;
      return value;
  }
  </code></pre>
  
  <p>To calculate the outline of a polygon I need the total amount of polygons. The input is performed in a loop. The input should end when the the last polygon data has the same coordinates as the first. E.g. first input would be X: 1 Y:1, X: 1, X: 2 would end the input.</p>
  
  <pre><code>    double fX = readDouble(); double x = 0.0;
      double fY = readDouble(); double y = 0.0;
  
      int nVertex = 1;
  
      while((x != fX) &amp;&amp; (y != fY)){
          nVertex++;
          x = readDouble(); y = readDouble();
      }
  </code></pre>
  
  <p>But the input in the loop is perfomed only ones. So something is  wrong with the break condition. </p>
  
  <p>any ideas?</p>