+ 1
In JavaScript when to use while loop and when do-while loop ?
4 odpowiedzi
+ 18
Use the do while if you want the code to at least execute once....
+ 4
do {
/* some actions to perform */
} while (/* some condition(s) tested after each iteration to do again or break loop */)
while (/* some condition(s) tested before each iteration to do loop stuff or break it */) {
/* some actions to perform */
}
+ 3
https://stackoverflow.com/questions/3347001/do-while-vs-while
Maybe this stackoverflow thread could help you?
+ 1
I have understood the difference between them but I am not getting where to use which loop ?