Intro to Coding with Blocks
Lesson 4 of 4 6 min +40 XP

Events: Making Things Happen

Programs that react to you.

What you'll learn

  • Understand what an event is
  • Connect an event to an action
  • Recognize event blocks
The doorbell that reacts

A doorbell does nothing until someone presses it, then it rings. Event-driven programs wait the same way — a click, a key, or a tap is the press that makes the code spring into action.

When this happens, do that

An event is something that happens that a program can notice — a key press, a mouse click, or a sprite being touched. Event blocks say 'when this happens, run these steps.' They let a program wait and react instead of only running top to bottom.

'When… ' starts the action

A block like 'when the green flag is clicked' or 'when space key pressed' is a hat block: everything under it runs the moment that event happens.

'When space key pressed → make the cat jump' — pressing space triggers the jump, again and again.

Knowledge Check

+10 XP / correct

1. An 'event' in a program is…

2. A block that says 'when space key pressed' will run its steps…