I'm currently doing a program, and I have arrived to a small problem. I want to ask the user whether or not he would like to try again the application after he has completed it once. If he says yes, I'd like to go back to the top of the program at a specific line. Is it possible? thank you.
Asked
Active
Viewed 455 times
-1
-
yes. use a `while loop` – sam Oct 14 '15 at 18:23
-
and I'd like it to ask again once he has completed it twice and so on. – R.DM Oct 14 '15 at 18:23
-
Could you please elaborate on how to use the while loop for this problem? – R.DM Oct 14 '15 at 18:23
-
Yes. Use a while loop. – Suresh Atta Oct 14 '15 at 18:24
-
Would i have to put the whole program into a while loop..? – R.DM Oct 14 '15 at 18:25
-
[While loop](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html). Whatever code you want to be repeated, place it under a loop – sam Oct 14 '15 at 18:25
1 Answers
1
DO{
// INSTRUCTIONS
// ASK THE USER IF HÉ WANTS TO CONTINUE.
// IF NOT, USE A BREAK TO SHUT OFF THE PROGRAM
} WHILE (TRUE);

Yassin Hajaj
- 21,337
- 9
- 51
- 89
-
why not make the condition a `boolean` variable, and then change the value based on user input inside the loop? – Blake Yarbrough Oct 14 '15 at 19:27
-