+ 1

In JavaScript when to use while loop and when do-while loop ?

5th Jun 2017, 2:04 PM
GARG
GARG - avatar
4 Respostas
+ 18
Use the do while if you want the code to at least execute once....
5th Jun 2017, 2:12 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 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 */ }
5th Jun 2017, 4:56 PM
visph
visph - avatar
+ 3
https://stackoverflow.com/questions/3347001/do-while-vs-while Maybe this stackoverflow thread could help you?
5th Jun 2017, 5:06 PM
visph
visph - avatar
+ 1
I have understood the difference between them but I am not getting where to use which loop ?
5th Jun 2017, 5:01 PM
GARG
GARG - avatar