← C Programming learning pathC Programming · Module 4 of 10
Loops
Repeat with for, while and do-while loops.
📖 Key ideas
- for (int i = 0; i < 5; i++) repeats 5 times.
- while (condition) checks first; do { } while (condition); runs at least once.
- break exits a loop; continue skips to the next round.
- Nested loops are loops inside loops (patterns, tables).
- Be careful with infinite loops.
💡 Real-life example: A do-while loop is like tasting food before deciding to eat more: you always taste once.
forLoop with start, condition and step
do-whileLoop that runs at least once
continueSkips to the next round
i++Adds 1 to i