When you use
continue
without a label, it terminates the current iteration of the innermost enclosingwhile
,do-while
orfor
statement 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?
continue
would always "jump up" in the source code.) – PopTOP: do { continue TOP; } while(false)
– Felicific