Feeling what the operator is doing continuein the loop do...while(false), I mocked a simple test case (pseudocode):
count = 0;
do {
output(count);
count++;
if (count < 10)
continue;
}while (false);
output('out of loop');
The solution was, to my surprise:
0
out of loop
A little confused, I changed the loop from do...whileto for:
for (count = 0; count == 0; count++) {
output(count);
if (count < 10)
continue;
}
output('out of loop');
Although functionally not the same, the goal is almost the same: to make the condition only complete the first iteration, and in the following continue (until a certain value is reached, purely to stop possible infinite loops). They may not run the same number of times, but the functionality here is not an important bit.
The output was the same as before:
0
out of loop
Now insert a simple loop while:
count = 0;
while (count == 0) {
output(count);
count++;
if (count < 10)
continue;
}
output('out of loop');
Once again, the same conclusion.
, continue " ". , : continue ? ?
(( , JavaScript, , -... js ))