title: Printing a statement only once in a while loop
body: <p>This is probably very simple, however I have completely blanked and would appreciate some pointers. I'm creating a small game we have been assigned where we select numbers and are then provided a target number to try and reach using the numbers we selected. Inside my while loop once my condition hits 6 it asks the user to generate the target number, however once they do it prints the same string again "Generate the final string" how do I print this only once?</p>
  
  <p>Here is the code if it will help.</p>
  
  <pre><code>while (lettersSelected == false) {
  
              if (finalNum.size() == 6) {
                  System.out.println("3. Press 3 to generate target number!");
  
              } // Only want to print this part once so it does not appear again.
  
  
              Scanner input = new Scanner(System.in);
  
              choice = input.nextInt();
  
              switch (choice) {
              case 1:
                  if (finalNum.size() != 6) {
                      largeNum = large.get(r.nextInt(large.size()));
                      finalNum.add(largeNum);
                      largeCount++;
                      System.out.println("Numbers board: " + finalNum + "\n");
                  }
  
                  break;
  </code></pre>