Challenge - 5 Problems
Continue Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of loop with continue inside if
What is the output of this C# code snippet?
C Sharp (C#)
for (int i = 0; i < 5; i++) { if (i == 2) continue; Console.Write(i + " "); }
Attempts:
2 left
💡 Hint
The continue statement skips the rest of the current loop iteration when i equals 2.
✗ Incorrect
When i is 2, the continue statement skips printing 2 and moves to the next iteration. So 2 is not printed.
❓ Predict Output
intermediate2:00remaining
Continue in nested loops
What will be printed by this C# code?
C Sharp (C#)
for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (j == 1) continue; Console.Write($"{i}{j} "); } }
Attempts:
2 left
💡 Hint
The continue skips printing when j equals 1 inside the inner loop.
✗ Incorrect
When j is 1, continue skips printing that pair. So pairs with j=1 are omitted.
❓ Predict Output
advanced2:00remaining
Continue with while loop and increment
What is the output of this C# code?
C Sharp (C#)
int i = 0; while (i < 5) { i++; if (i == 3) continue; Console.Write(i + " "); }
Attempts:
2 left
💡 Hint
The increment happens before the continue check.
✗ Incorrect
When i becomes 3, continue skips printing 3. All other values print.
❓ Predict Output
advanced2:00remaining
Continue inside foreach loop
What will this C# code print?
C Sharp (C#)
string[] words = {"apple", "banana", "cherry"};
foreach (var word in words)
{
if (word.StartsWith("b")) continue;
Console.Write(word + " ");
}Attempts:
2 left
💡 Hint
Continue skips words starting with 'b'.
✗ Incorrect
The word "banana" starts with 'b' and is skipped. Others print.
❓ Predict Output
expert3:00remaining
Continue with multiple conditions in for loop
What is the output of this C# code snippet?
C Sharp (C#)
for (int i = 0; i < 6; i++) { if (i % 2 == 0) continue; if (i == 5) continue; Console.Write(i + " "); }
Attempts:
2 left
💡 Hint
Continue skips even numbers and also skips 5.
✗ Incorrect
i=0,2,4 skipped because even; i=5 skipped explicitly; only 1 and 3 print.