Skip to main content

"When I step on…": event-driven coding for grades 3–5

The PEEMS team · Published November 10, 2026 · 3 min read

The Pemi CS level "Rolling rules": Pemi on an icy floor with "when I step on" event blocks

In event-driven coding, a program waits for something to happen and then reacts. Pemi CS levels such as "when I step on…" help children in grades 3–5 meet the idea through play.

There is a kind of coding children already know without noticing: wait for something to happen, then act. The doorbell rings, so you open the door. The drum sounds, so you line up. In programming, this is called an event.

What is an event?

An ordinary program runs from top to bottom. With event-driven coding, we write rules in advance: "when this happens, do that". The program only reacts when the event actually arrives.

Everyday examples:

  • When the doorbell rings, then go and open the door.
  • When the traffic light turns red, then stop.
  • When you step on the doormat, then wipe your shoes.

In the game: Pemi meets events

In Pemi CS for grades 3–5, children meet event blocks right inside the game. In one level, the floor is frozen and Pemi slides across it. Children attach a rule to each painted sign: when Pemi steps on the triangle, turn one way; when it steps on the circle, turn the other.

The Pemi CS level "Rolling rules": event blocks "when I step on triangle" and "when I step on circle" beside an icy floor with signs

Each time Pemi lands on a sign, the matching rule runs. Another level, "Round the clock tower", uses a glitch event, so Pemi knows what to do whenever a glitch appears on the path.

The Pemi CS level "Round the clock tower": a "when it sees a glitch" event block and a fix block, with Pemi walking around a clock tower

Why is this idea worth meeting early?

  • Children learn to think in rules instead of listing every single step.
  • One rule can be reused many times, in many places on the map.
  • They practise predicting what will happen, then running the program to check: a first step toward debugging.

Try it at home (no screen needed)

Play "when… then…": you say an event ("when I clap"), your child decides the action ("then I jump once"). Swap roles, then try two rules at once. A few minutes and lots of laughter is plenty.

Frequently asked questions

How is an event different from a loop or a condition? A loop repeats. A condition chooses what to do depending on the situation. An event waits for something to happen and then reacts. The three ideas are often used together.

How can I tell my child has understood "events"? Ask them to tell it back: "When what happens, what does Pemi do?" If they can give both halves, they have the main idea. They do not need the word "event".

What if my child is not used to text blocks yet? They can start with levels from the younger groups and work their way up.

How is the "when I step on…" level different from the "when it sees a glitch" level? Both are "when… then…" rules. The "when I step on…" level ties rules to symbols drawn on the floor; the "when it sees a glitch" level ties a rule to the Glitch that appears along the path.

Want to try it together?

Curious about "when… then…" levels for grades 3 to 5? Pemi CS is open and international families are welcome to register their interest by email.

Keep reading: From block coding to Python: when is the right time to switch? · If/else conditions: which way does Pemi go?

The PEEMS team

Nov 10, 2026

Switching to Python too early frustrates children; too late and they get bored. This article lists signs of readiness, a path from picture blocks to text blocks to Python, and why ideas should come before syntax.

Nov 10, 2026

If/else lets a program choose what to do depending on the situation. In Pemi CS, children in grades 3–5 practise it by helping Pemi decide which way to go around obstacles.

Nov 10, 2026

A variable is like a labelled box in which a program remembers a value, such as how many seed bags it has picked up. Pemi CS's seed store level helps children in grades 3–5 meet this idea.