while (goodInput=false)
{
try
{
System.out.println("How long is the word you would like to guess?");
wordSize=scan.nextInt();
while(wordSize>word.longestWord())
{
System.out.println("There are no words that big! Please enter another number");
wordSize=scan.nextInt();
}
goodInput=true;
}
catch(InputMismatchException ime)
{
System.out.println("Thats not a number! Try again");
}
}
I am trying to prompt a user for a number but i cant get it to run correctly. I want it to keep running until the correct input is entered.
One issue is:
Assigns
falsetogoodInputwhich becomeswhile(false)that leads to loop being not executed at allchange it to