C in 100 Seconds: while vs do-while — Two Ways to Loop | Episode 7
0views
002:25
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
C has two kinds of while loops and they behave a little differently.
The regular while loop checks the condition before running anything — if it's false from the start, the body never executes. do-while flips
this around — it runs the body first, then checks. That means it's guaranteed to run at least once.
Count up with while, count down with do-while. Same idea, different timing.
Student code: https://github.com/GoCelesteAI/c-in-100-seconds/tree/main/episode07
What You'll Learn:
• while — checks condition first, then runs the body
• do...while — runs the body first, then checks
• i++ to increment, j-- to decrement
• The guaranteed-at-least-once pattern
Next: Episode 8 — For Loops
#c #programming #100seconds #learnc #while #dowhile #loops #tutorial
Tags
c while loop, do while c, while vs do while, loops c, i++ c, c tutorial 2026, c beginner, 100 seconds, learn c, coding tutorial
Tags
c while loopdo while cwhile vs do whileloops ci++ cc tutorial 2026c beginner100 secondslearn ccoding tutorial