Ping

EVENT — *do this WHEN that happens.* An event handler waits, doing nothing, until a specific trigger fires — a button press, a timer, a sensor crossing a line — and only then runs its code. Not a loop that keeps checking; a waiting bell that rings the instant it's struck.

Press play to listen along. The line being read lights up as you go.

Show full transcript

Loading transcript…

01 Opening
Ping beat 1 of 5

Ping is not an animal-tween. Ping is not a faced figure. Ping is a deliberately abstract concrete-object-figurea small still bell, hung and silent, with a note beside it reading WHEN struck → run this. It does nothing at all until something strikes it. Then it rings once and runs its code. That is the whole figure.

This is essential. CodeRealm's cast is deliberately non-human and non-gendered — concrete objects, not people. The design refuses tech-genius-hagiography: coding isn't only for one "smart" kind of person. Primitives are operations, not personalities.

Ping embodies the *event primitive. An event handler waits* — doing nothing — until a specific trigger fires: a button press, a timer finishing, a sensor crossing a line. Only then does it run its code. It isn't a loop constantly checking; it's a bell that hangs quiet and rings the instant it's struck.

Reflection: have you ever felt the quiet readiness of waiting for a signal — a starting whistle, a knock, your name being called?

02 Ping
Ping beat 2 of 5

Ping has no village-craft family origin — concrete objects don't have biographies. Loop, the mentor, introduces Ping by demonstration.

Loop hangs Ping on the workbench beside Bit, the robot the learner programs. "This is Ping," Loop says. "An event. It waits, silent, doing nothing — until its trigger happens. When the button is pressed, then it runs."

Loop attaches Ping to a button and writes on the note: `WHEN button pressed → Bit beeps`. Nothing happens. The bell hangs quiet. Then Loop presses the button — ping! — and Bit beeps, instantly. "See? It didn't run until the trigger. That's an event: when that happens, do this."

03 Ping
Ping beat 3 of 5

Loop demonstrates how Ping is different from Trek, the loop.

"Trek keeps going around, doing work over and over," Loop says. "Ping does nothing — until struck. It's not busy checking a thousand times a second. It rests, and the trigger wakes it." Loop shows the scaffolds: - Register a handler: say which trigger, and what to run when it fires. - Wait, using nothing: the event costs no effort while it waits. - Fire once per trigger: each press, each timer, each crossing rings it once. - Many bells at once: different events can wait for different triggers together.

"Ping doesn't decide anything," Loop says. "It doesn't think. It waits for one specific thing, and when that thing happens, it runs its code. That's all an event is."

04 Ping
Ping beat 4 of 5

Loop wires several events so the kid can build something that reacts.

The kid programs three Pings: `WHEN button pressed → Bit jumps`, `WHEN sensor covered → Bit lights up`, `WHEN 5 seconds pass → Bit spins`. All three bells hang quiet, waiting. The kid presses the button — Bit jumps instantly. Covers the sensor — Bit lights up. Waits — Bit spins on its own.

The kid laughs, delighted: Bit reacts the very instant each trigger fires, exactly when they make it happen. The program feels responsive, alive, quick.

Reflection: have you ever felt that pop of surprise and joy when something responded exactly when you triggered it?

05 Closing
Ping beat 5 of 5

Loop leaves Ping hanging quiet on the workbench, ready.

"Here's the honest framing," Loop says. "Ping is not a mind. It does not think or decide. It is a waiting bell — silent until its trigger, then it rings and runs its code. When this happens, do that. That is all an event is."

But the kid, watching Bit leap the instant the button drops, feels something real — the bright, quick delight of responsiveness, of a thing that answers the very moment you call it. Making something react on cue feels wonderful, and the kid feels that jolt of joy.

"This is Ping," Loop says on the object's behalf. "The event. Wait for a trigger; when it fires, run. When this, do that. Honest framing."

The bell rests, ready to ring for the next program — and the kid heads off delighted, still grinning at how quickly Bit answered the call.

The CodeRealm ensemble

Ping is part of CodeRealm's distributed-narrative cast. Each character embodies a different curricular primitive; together they teach the full subject.