title: Java: Incrementing a variable inside of a for loop
body: <p>I am in a beginner Java class and for a project I need to count how many times a condition returns TRUE(correctGuess)  or FALSE(incorrectGuess) with a loop inside of a loop. The problem that I'm having is that the variables being incremented within the inner loop do not hold their incremented value as the loop reiterates. Therefore, the outer while-loop's condition is never false. I'm really new to programming and I can't figure out the solution. Thank you in advance for your time with this silly question and if there are any questions I would be happy do a better explanation. The code looks like this:</p>
  
  <pre><code>    int incorrectGuess = 0;
      int correctGuess = 0;   
  
      while(incorrectGuess &lt; 6 &amp;&amp; correctGuess &lt; WORD_LENGTH) {
  
          //Gets the users first guess
          System.out.print("Please guess a letter [A-Z]: ");
          letterGuessed = keyboard.nextLine();
  
          for (int i = 0; i &lt; WORD_LENGTH; i++){
              char value = wordLetterArray[i];
              String letterArray_value = String.valueOf(value);
  
              if(letterGuessed.equals(letterArray_value)){
                  ++correctGuess;
              }
  
              else
                  System.out.println("Bad comparison!");  
  
              if(i == WORD_LENGTH)
                  ++incorrectGuess;   
  
          }   
      }
  </code></pre>