How a lion helped us practice coding (without a screen in sight)
The other day I was sitting on the sofa with a stack of picture books, wondering if I could turn them into a game. With The Lion Inside on my lap, my toddler and preschooler learned conditional logic without a tablet, without an app, and without a single toy specially designed for that purpose
With my background and interest in AI and logic, I often catch myself thinking about how to translate that abstract world into my children’s everyday experience. Coding sounds to many parents like something that needs a tablet, an expensive app, and hours of screen time. But the foundation of every program is actually very simple: it is just a set of rules and agreements.
Both children can happily snuggle up to me and listen for an hour. Fortunately there is a sweet spot somewhere around advanced toddler books and simple preschool books where they are both interested (think The Lion Inside by Rachel Bright and Jim Field, or I’d Really Like to Eat a Child by Sylviane Donnio). Maybe it’s the parent who craves a bit of variety and interaction, rather than the children.
Then I thought: what if we use the books we have already read a hundred times to practice the basics of conditional logic (If-Then-Else)?
On the sofa with a lion and a mouse
I picked up The Lion Inside (there is a Dutch board book edition now too!) and they both came to sit attentively beside me. Their favourite thing about this book is the sounds: the loud ROAR, and the soft roar, EEEEEK and HAHAHAHA. So I wanted to keep that contrast between loud and soft, plus another explosive element.
My only worry was that the ‘actions’ would from now on always happen when we read this book and I would be stuck with two clapping children everytime we read this book. Spoiler: thankfully that did not happen. Only the loud sounds stayed. And while they do those loud sounds, they take turns holding the book and enjoying their moment in the spotlight.

Why If-Then-Else is the perfect language exercise
For anyone who isn’t immersed in code daily: If-Then-Else is how a computer makes decisions. If A happens, then we do B. Otherwise we do C. That is exactly how young children discover the rules of the world around them. By introducing this conditional logic during traditional storytime, we teach them in an active, analogue way how pattern recognition and rule-following work.
And the best part? We make abstract coding structures tangible and hilarious with the picture books we already have on the shelf. Similar to how my children reprogram the rules of a game in the backyard, but on the sofa with a book they already know by heart.
Algorithmic storytelling at home
This is the simplest hack to get your toddler and preschooler actively involved in a book they already know inside out. It takes focus, listening, and applying an agreed rule at speed.
Goal: introduce conditional logic (If-Then-Else) during reading time.
What you need: a picture book your child knows well. I chose The Lion Inside, but any book with recurring elements or characters works. Other Rachel Bright and Jim Field stories are favourites here too (we also have them on the Yoto in English, and I recorded the lion story myself in Dutch for a homemade Yoto card).
The rules: agree on game rules with your children beforehand.
| Rule | What you do |
|---|---|
| Rule 1 (the If-Then-Else) | If the lion on the page is asleep, then we whisper the text. Else we read in a normal voice. |
| Rule 2 (the Loop) | If the zebra is visible, we clap twice. |
Read the book aloud and let your child ‘check’ you (and vice versa!).
What to watch for:
- How quickly does your child spot the ‘trigger’ (for example the lion with his eyes closed) on the page?
- What happens when you as the parent deliberately introduce a ‘bug’ in the code and read loudly while the lion is asleep?
- How does the two-year-old respond? Does he copy the physical action (like clapping) without really grasping the rule? And does he notice when you drop the rule?
How it played out in our living room
My oldest (4) clapped enthusiastically but was not yet watching for the zebra. He was very alert to whispering when the lion appeared. He came up with his own extra rule that we had to make lots of noise when the mouse came into view. Nice! In programming terms he had just written his first User Defined Function.
Both children joined in enthusiastically with the actions, while the youngest (just turned 2) copied the oldest but did not start on his own. What they both also love, separate from our rules, is doing a very loud roar for the lion, a soft one for the mouse, squeak and hahaha. On top of these rules they both still do the exclamations the moment the page turns. I do not need to initiate that; it has become their fixed routine.
They thought this was a fun game. With another book I tried asking follow-up questions about predictions and that went fine too (which animal is boss next in Koning, a book by Mark Janssen and Suzanne Diederen). I managed to briefly touch upon what it means to be a boss or the authority, but then got a loud ‘Mum, keep reading!’ back from the oldest. Message received: I had gone on too long here.

The reality check
If you follow my blog, it might look like I add this kind of game and discussion to everything, but that’s not the case. Depending on how the week goes, I sometimes go weeks without doing any of it. Usually reading is just reading and playing is just whatever game my child makes up. Then I follow their wishes and interests and they invent the game.
Lesson for myself: do not get too enthusiastic and go deep when you notice your child finds this interesting. Keep it to a few sentences and save the discussion for another moment.
Playbook for algorithmic reading
Three practical tips from our home:
- Start with one simple rule: Whispering when the lion is asleep is enough for the first go. Only add the zebra clap or mouse noise afterwards. Too many rules at once and you lose them.
- Let your child debug: Deliberately introduce a ‘bug’ in the code (read loudly when the lion is asleep). The oldest corrected me straight away. That is exactly the pattern of a debugger checking a script.
- Follow their own extensions: My preschooler invented the mouse rule himself. That is more valuable than any rule I plan in advance. Even if the result is two bouncing children on the sofa.
Why this does not need a screen
Coding for my two- and four-year-olds is not yet a language behind a laptop. It is a game with agreements, triggers, and actions. The Lion Inside delivers the perfect triggers: sleeping lion, squeals, recurring zebra. No Cubetto, no app, no subscription.
Next time we go to the library I will again look for picture books with recurring characters or fixed sounds. Not every story suits this, but the idea that you might spontaneously borrow something you can turn into a game like this, without an app and without major preparation, is what keeps me inspired. The Lion Inside just sits on the shelf now, ready for an evening of plain read-aloud time.
Related articles
More articles on a similar topic.
Comments (0)
No comments yet. Be the first!
Leave a comment
Comments are moderated before they appear.