From here:
The continue statement passes control to the next iteration of the
nearest enclosing do
, for
, or while
statement in which it appears,
bypassing any remaining statements in the do
, for
, or while
statement
body
Because the closest one of these is the while(false)
statement, execution flow continues to that statement, and exits the loop.
This would be true even if there were other statements between the continue
and while(false)
For example:
int main()
{
int i = 1;
do
{
printf("%d\n", i);
i++;
if (i < 15)
continue; // forces execution flow to while(false)
printf("i >= 15\n"); // will never be executed
} while (false);
...
The continue;
statement here means the printf
statement following it will never be executed because execution flow continues to the nearest one of the loop constructs. Again, in this case while(false)
.
continue
will be executed because2 < 15
is true. – Righthandedfalse
andtrue
(andbool
), you can#include <stdbool.h>
. – Lobbycontinue
. Meaning does it go back to the top of the loop, or does it go to the while condition. – Fernandes