Python Loops (For, While, Do-While) & Jump Statements
C provides 3 core iteration constructs: for loops for bounded iteration, while loops for precondition polling, and do-while loops for at-least-once execution. Use continue to skip cycles and break to terminate immediately.
"A for loop is a fixed 100-meter sprint; a while loop is jogging until it starts raining; a do-while loop is taking at least one sip of soup before deciding if it is too hot."
Deep Dive: How It Works
for Loop: Composed of initialization, condition check, and increment expression.
while Loop: Evaluates condition before executing the loop body.
do-while Loop: Guarantees execution at least once before testing condition.
Syntax Blueprint
for (int i = 0; i < N; i++) {
if (i == 2) continue;
printf("%d\n", i);
}Standard indexed iteration loop with continue to skip to the next iteration.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Off-by-one errors with <= vs <.Why it happens: Iterating for (int i = 0; i <= size; i++) over an array of length size accesses invalid memory.
How to fix: Use i < size for 0-indexed structures.
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Calculate Range Sum with For Loop
Calculate the sum of integers from 1 to 5 inclusive using a second for loop.
Print "Sum: %d\n" with the calculated sum.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.