+ 1
Why does this run once?
Why does the following code only run once? do {} while(false)
3 Respuestas
+ 11
do while is an exit control loop, meaning condition will be checked after execution. So, loop runs once, check condition, exits if false.
+ 8
because the condition to stop the loop comes after the code to be executed in the loop.
read it like: do the following. repeat it while xxx is true.
these are two commands. your program does the first before it knows the second.
0
do-while loops run at least once. The DO part runs, then the WHILE is checked for loop condition and since it's false, the execution of the loop stops