+ 1
While vs. do while loops
What is an example of a situation where a do while loop would be more appropriate than a while loop? By my understanding, the only difference is that the former goes through at least one iteration while the latter does not necessarily do so
3 Respostas
+ 1
There is DO WHILE in Java? Never used it.
A place where you want to run things at least once, is the program itself. A typical pattern is a loop that waits for input while a boolean is true.
+ 1
use do while in case you need to ensure the loop will execute at least one time
+ 1
Find that on youtube exactly that and they get in Details and explain it.