+ 1
In which conditions do..while is useful ?
2 Réponses
+ 7
do while is useful in case when we want to execute loop atleast once.such as the further execution of loop depends on user input
0
to extend his answer... say you want to run a lofop, each iteration asked user a question, then you want to keep running the loop until you get a specific answer.
int age;
do{
system.println.("what is your age?");
age = system.readline();
} while(age < 18);
syntax a little off, on my phone and I'm super tired. but you should get point.