When you use
continuewithout a label, it terminates the current iteration of the innermost enclosingwhile,do-whileorforstatement and continues execution of the loop with the next iteration.
I’m not sure why the following piece of code does not work as I expect.
do {
continue;
} while(false);
Even though the while condition is false, I expect it to run forever since continue jumps towards the start of the block, which immediately executes continue again, etc. Somehow however, the loop terminates after one iteration. It looks like continue is ignored.
How does continue in a do-while loop work?
Check out this jsFiddle: http://jsfiddle.net/YdpJ2/3/
It appears to hit the continue, then break out of that iteration to run the check condition. Since the condition is false, it terminates.