-
Consider the following code snippet.
while (n != 0)
{
if (n == 1)
continue;
else
n++;
}
What will be the role of the continue keyword in the above code snippet?
-
- The continue keyword breaks out of the loop
- The continue keyword restarts the loop
- The continue keyword skips the next iteration
- The continue keyword skips the rest of the statements in that iteration
- None of these
Correct Option: D
Instead of exiting a loop like the break keyword, the continue keyword moves to the next iteration from the place encountered. While the break statement breaks out of the loop.