Repeating with while
Keep going while a condition is true.
Repeating with while is a free Coding for Kids lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Another Kind of Loop 🔄
Hello, loop legend! 🦸 The while loop repeats as long as something is True. Like "keep jumping WHILE the music plays"! 🎵
The while Word ⏳
while checks a condition. As long as it is True, the loop keeps going!
count = 0
while count < 3:
print("Hi! 👋")
count = count + 1Counting Up ⬆️
We need a counter that changes, or the loop never stops! Here count goes up by 1 each time.
count = 1
while count < 4:
print(count)
count = count + 1Adding One Each Time ➕
count = count + 1 means "take count and make it one bigger". This helps the loop end! 🎯
n = 0
while n < 5:
print("Step " + str(n))
n = n + 1When Does It Stop? 🛑
The loop stops when the check becomes False. When count reaches the limit, it ends!
count = 0
while count < 2:
print("Loop! 🔄")
count = count + 1
print("Done! ✅")Careful: Forever Loops! ♾️
Warning! If the counter never changes, the loop runs FOREVER! 😱 Always remember to update your counter.
count = 0
while count < 3:
print("safe loop")
count = count + 1Countdown! 🚀
We can count DOWN too! Subtract one each time until we blast off!
count = 3
while count > 0:
print(count)
count = count - 1
print("Blast off! 🚀")Cheer a Few Times 📣
Let us cheer until our counter reaches the limit!
cheers = 0
while cheers < 4:
print("Go team! 📣")
cheers = cheers + 1while vs for 🤔
for is great when you know HOW MANY times. while is great when you repeat UNTIL something happens! 🎯
Filling a Jar 🍯
Let us fill a jar with cookies until it has 3!
cookies = 0
while cookies < 3:
cookies = cookies + 1
print("Cookie added! 🍪")You Mastered while! 🎉
Amazing! Try a loop that prints "Hop" while a counter is less than 3.
h = 0
while h < 3:
print("Hop! 🐰")
h = h + 1Quick Check 🧠
Quiz time! 🎯 Why do we change the counter inside a while loop?
Recap Time! 🌟
Loop legend! 🎓 Today you learned:
whilerepeats as long as True- Always change the counter, or it loops forever
count = count + 1counts up- Use
whileto repeat UNTIL something happens
You are a while wizard! 🧙
Frequently asked questions
Is the “Repeating with while” lesson free?
Yes — the full text of “Repeating with while” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.
What will I learn in “Repeating with while”?
Keep going while a condition is true. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Coding for Kids?
No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Repeating with while” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Coding for Kids lesson?
Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Why Loops Are Awesome
- Counting with for
- Repeating with while
- Drawing Patterns