Event block: when key pressed
An event block that waits for a key to be pressed. Each time you press the key you chose, the blocks stacked under it run. You can pick a different key from the drop-down list.
Understanding Event block: when key pressed in Years 5–6 Creating Digital Solutions
What it does: Two separate event blocks, each with its own key, let one program respond to different keys in different ways. The say block is stacked under the event block, so it runs each time the space key is pressed. The key is chosen from the drop-down list on the event block. You do not type it in. The script runs once for each key press, so pressing the key 3 times runs it 3 times. The event block must be at the top of the stack. Blocks placed above it will not be started by the key press.
Common mistakes: Line 3 uses the left arrow key again, so both scripts run on the left arrow and the right arrow does nothing. It should be 'when right arrow key pressed'. Direction 270 faces left, but this script runs when the right arrow key is pressed. It should be 'point in direction 90'.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 41–50) and word search (Modules 41–74).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
when space key pressedFill in the Blanks
Spot the Error
Student with a class code? Join your class →