Learning Goals 3 min
By the end of this lesson you will be able to:
- Use
stop [all v]andstop [this script v], and say what each one halts. - Explain why nothing can be attached below a stop block.
- End a forever loop from inside a script, without touching the red stop sign.
Warm-Up 7 min
Your party runs forever, which was the whole point. But the only way to end it is to reach over and hit the red octagon — and that is not an ending, it is an interruption.
Quick-fire puzzle
Faiz wants his cat to take a bow after its dance. He built this and it never bows. Why not?
when flag clicked
forever
turn cw (15) degrees
wait (0.1) seconds
end
Reveal the answer
There is nowhere to put it. A forever has no notch underneath, because anything there could never run — the loop never finishes.
What Faiz actually needs is a way to end the loop from inside. That is today’s block.
New Concept — the stop block, and its dropdown 15 min
Think of stop [all v] as a full stop at the end of a sentence. Once it runs, that sentence is over. But this full stop has a dropdown, and the dropdown decides how much it ends.
Blocks reference
| Block | Category | What it does |
|---|---|---|
stop [all v] | Control | Halts every script in the whole project — every sprite, all at once. The red stop sign in block form. |
stop [this script v] | Control | Halts only the stack it is part of. Everything else carries on untouched. |
A third block shape: the cap
You know hats, which can only go on top, and stack blocks, which go anywhere in the middle. Stop blocks are caps: a notch on top so they can attach, and a flat bottom so nothing can attach to them.
Once again the shape is telling you the truth. Nothing after a stop could ever run, so Scratch removes the possibility.
Choosing between them
| What you want | Which one |
|---|---|
| “Game over — end everything.” | stop [all v] |
| “This dancer is finished, but the party continues.” | stop [this script v] |
| “End my forever loop, leave everyone else alone.” | stop [this script v] |
| “The player lost — freeze the whole thing.” | stop [all v] |
A useful rule of thumb: reach for this script unless you genuinely mean to end the entire project. Stop-all is loud, and in a project with several sprites it stops things you may have forgotten about.
Escaping a forever
Here is the trick that makes today matter. A stop block placed inside a forever loop will end it — because the stop runs on some pass through the loop, and once it runs the script is over.
That is how an endless routine gets a proper ending instead of a rescue.
Why it matters
A project that can only be ended by pulling the plug never feels finished. Being able to say “this part is done now” is what separates a demo from a show.
Worked Example — a forever that ends itself 15 min
We take the endless spin and give it a proper finish, then compare what the two dropdown options actually do.
Step 1 — Start with an endless spin
Build the forever spin from last lesson and confirm it never stops on its own.
when flag clicked
forever
turn cw (15) degrees
wait (0.1) seconds
end
Step 2 — Give the cat a way out
Restructure it so the spinning happens a set number of times, then the script stops itself deliberately.
when flag clicked
repeat (24)
turn cw (15) degrees
wait (0.1) seconds
end
say [Thank you!] for (2) seconds
stop [this script v]
Step 3 — Notice the stop is optional here
Run it. Now delete the stop block and run it again. It behaves identically, because the script had already reached its end.
That is worth understanding: a stop at the very bottom of a finite script changes nothing. Stop blocks earn their keep when there is something they need to cut short.
Step 4 — Put a stop inside a forever
Now the real use. Build a second script on the dancer sprite so you have two things running, then give the cat this.
when flag clicked
forever
turn cw (15) degrees
wait (0.1) seconds
stop [this script v]
end
Step 5 — Watch what does not stop
Run it. The cat turns once and freezes. The dancer keeps going, completely unaffected. The forever loop really did end, from inside, without touching the stop sign.
Step 6 — Now try the other dropdown
Change the dropdown to all and run it again. This time the dancer freezes too, along with everything else in the project.
One word in a dropdown, and the difference is between ending your own performance and ending the whole show. Try it both ways until the distinction is obvious.
What changed: your scripts can now decide when they are finished, instead of running until somebody intervenes.
The full assembled stack (your reference)
when flag clicked
repeat (24)
turn cw (15) degrees
wait (0.1) seconds
end
say [Thank you!] for (2) seconds
stop [this script v]
Try It Yourself — three small builds 12 min
Goal: Make a polite spin — the cat turns for a while, thanks the audience, and finishes without the stop sign.
when flag clicked
repeat (20)
turn cw (18) degrees
wait (0.1) seconds
end
say [Terima kasih!] for (2) seconds
stop [this script v]
Think: twenty turns of eighteen degrees is 360 — a full circle, ending exactly where it began. Neat endings usually come from neat numbers.
Goal: Two performers, one exit. Make the cat finish its routine and take a bow while the dancer keeps going.
when flag clicked
repeat (12)
move (20) steps
if on edge, bounce
wait (0.1) seconds
end
say [My turn is over!] for (2) seconds
stop [this script v]
Think: put this on the cat and give the dancer a forever loop of its own. Then change the dropdown to all and watch the dancer die mid-move — the clearest demonstration of the difference there is.
Mini-mission: the timed finale. Build a show where two sprites dance endlessly, and a third script ends the whole thing after a fixed number of seconds — like a song running out.
It works if: both sprites dance from one flag click, nobody stops early, and the whole show ends by itself at a time you chose. Keep each stack under 8 blocks.
Think: which dropdown do you need here, and where does the timing script live? It does not have to be on either dancer.
Mini-Challenge — one stops, one carries on 5 min
“Prove you know the difference”
Build a demonstration that shows a classmate the difference between the two dropdown options, without you having to explain it in words.
It works if:
- Both versions start from one flag click and have two sprites doing something endless.
- In one version everything freezes at the same moment.
- In the other, exactly one sprite freezes and the other carries on.
- The only difference between the two versions is a single dropdown.
Reveal one valid solution (teacher)
Give the dancer a plain forever routine, and the cat this — then run it once with each dropdown setting.
when flag clicked
repeat (10)
turn cw (36) degrees
wait (0.1) seconds
end
stop [this script v]
Pupils often try to demonstrate this with only one sprite, where the two options look identical. Realising that you need a second sprite for the difference to be visible is the lesson.
Recap 2 min
Stop blocks are caps: they attach on top and nothing attaches below, because nothing after them would run. The dropdown decides the reach — all ends the entire project, this script ends only the stack it sits in. Placed inside a forever, a stop is the way an endless loop gets a proper ending instead of a rescue.
- stop (block)
- A Control cap block that ends scripts. The dropdown decides how many.
- Cap block
- A block with a notch on top and a flat bottom. Nothing can attach beneath it.
- stop all
- Ends every script in the project at once, like the red stop sign.
- stop this script
- Ends only the stack it sits in. Everything else keeps running.
Homework 1 min
The self-ending spin. Build a routine that finishes by itself, then test what each dropdown option does to it.
- Build the spin-and-bow script from the Worked Example.
- Add a second sprite with a simple forever routine.
- Run it with the cat’s stop set to this script, and note what the second sprite does.
- Change it to all and run again. Screenshot both results if you can.
when flag clicked
repeat (24)
turn cw (15) degrees
wait (0.1) seconds
end
say [Thank you!] for (2) seconds
stop [this script v]
Bring back next class:
- Your screenshots or notes from both runs.
- Your answer to: “Why do you need two sprites to see any difference between the two options?”
Heads up for next class: SCR-L01-22 is the arc finale. Everything from these eight lessons becomes one Dance Routine you save and show.