Okay so I am a total noob when it comes to Java so apologies if this is a stupid question. I have a while loop set up like so:
do {
//quiz questions, lose a life when you get one wrong
} while (livesRemain > 0)
However, when you lose all of your lives the loop does not end and continues through the loop even when all lives are lost. Would I use something else other than while or do while that will end when a certain condition is reached?
The questions are like this:
System.out.print(question1)
if (guess == 1) {
System.out.print("Correct")
score++;
} else {
livesRemain--;
}
When you reach the end of the quiz, it prints your score which ends up going into the negatives if you go below 0.

livesRemain. Maybe it isn't there?while-loop looks fine. Have you made sure, thatlivesRemainis actually decremented? Maybe there exist two variables with the same name. Hard to tell though without codelivesRemainis still more than 0.