Skip to content
Sign upLog in
question about while loops
Profile icon

How can I make a while loop only loop once and then ask for user input again? Right now, my while loop goes on forever, but I want it to loop one time, then ask for user input.

You are viewing a single comment. View All
Answered by cuber1515 [earned 5 cycles]
View Answer
Profile icon


while(yandn.equals("y")) { String yandn = scan.nextLine(); ... }

Let me know if this doesn't work :).