← Lesson
BitWithBite
Scratch · Quick Reference

Lesson 6 — Loops Cheat Sheet

Scratch
In one line: Imagine you want a sprite to spin 10 times. Without loops, you'd have to drag 10 "turn" blocks. With a loop, you just write it once and tell Scratch how many times to repeat it!

Key Ideas

1Why Do We Need Loops?. Imagine you want a sprite to spin 10 times. Without loops, you'd have to drag 10 "turn" blocks. With a loop, you just write it once and tell Scratch how many times to ...
2Repeat vs Forever — Choose the Right Loop 🔢 Repeat Control block — yellow-orange repeat (10) Runs the blocks inside a specific number of times, then stops and continues to the next block. 🎯 Use when: you want something to happen a set number of times — spin 5 times, flash 3 times, jump 10 times. ♾️ Forever Control block — yellow-orange forever Runs the blocks inside non-stop until you press the red stop button. Nothing comes after forever (it never ends!). 🎯 Use when: you want continuous action — animations, walking, checking for keyboard presses, game loops. HOW A FOREVER LOOP WORKS — FLOW DIAGRAM 🚩 When flag clicked ↓ ♾️ Forever ↓ Do something ↓ Keep going? YES (always!)↖ NO (stop button)STOP ⏹ 1. Flag clicked — loop starts 2. Runs the blocks inside 3. Jumps back to the start 4. Repeats endlessly! FeatureRepeat (N)Forever Runs a set number of times✅ Yes❌ No Runs forever until stopped❌ No✅ Yes Code can continue after it✅ Yes❌ No Best for animations👍 Sometimes✅ Usually Best for game loops❌ No✅ Yes Section 3 Build: Dancing Robot 🤖. Let's build a robot that dances forever using both types of loops — a Forever loop for continuous dancing, and Repeat inside for each dance move!
3Bonus: Nested Loops 🪆. You can put a loop inside another loop! This is called a nested loop. The inner loop runs completely every time the outer loop runs once.

Code Examples

turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees turn 36 degrees
repeat (10) turn 36 degrees end