Scratch looks like a toy, but under the colourful blocks are the same ideas used in every programming language. Knowing them helps you ask better questions when your child shows you a project.
Events: "when this happens"
An event starts a script. Examples:
- when green flag clicked
- when space key pressed
- when this sprite clicked
- when I receive (message)
Programs spend most of their time waiting for events. A game waits for a key press; a button waits for a click. Without events, nothing would respond to the player.
Sequences: one after another
Blocks stack from top to bottom and run in order. Changing the order changes the result: say Hello then move looks different from move then say Hello. This is the simplest idea, and also the one that most often explains a bug.
Loops: do it again
A loop repeats blocks.
- repeat 10 runs them ten times.
- forever runs them until the project stops.
- repeat until (condition) keeps going until something becomes true.
Instead of dragging out ten move blocks, you use one inside a loop. Programmers call this "don't repeat yourself."
Conditions: if this, then that
An if block checks something and only runs its blocks when it's true.
- if touching edge then bounce
- if score > 10 then say You win!
Add an else to say what to do otherwise. Conditions let a program make choices.
Variables: remembering things
A variable is a named box that holds a value. The score in a game, the number of lives, a player's name: each lives in a variable.
You can set it to a number, change it by an amount and show it on the stage.
Broadcasts: sprites talking to each other
A broadcast sends a message that other scripts can receive with when I receive. It's how a character can tell the game "I've been hit" so another sprite can react. Broadcasts help children structure bigger projects.
Putting it together
A simple catch game uses all of these:
- An event (green flag) starts the game.
- A loop (forever) keeps the apple falling.
- A condition checks whether the apple touches the bowl.
- A variable holds the score.
How to talk about it
Instead of "how did you make that?", try: "What starts it?", "What repeats?", "What does it keep track of?" Those three questions point to events, loops and variables.
Where it leads
These ideas carry over to Python, HTML and JavaScript. Try making something with them in our first Scratch projects, or read about the Scratch course.