What a first coding lesson can teach a child
A child's first coding lesson teaches much more than code: logic, patience, problem-solving and confidence. Here's what happens, and how to run one well.
Here's a moment worth watching. A 9-year-old girl sits in front of a computer for her first coding lesson. On the screen is a cartoon cat. The teacher says: "Make the cat walk to the tree."
She drags a block that says "move 10 steps." She clicks. The cat moves… a tiny bit. She frowns. She adds another block. And another. And another. After eleven blocks, her friend says, "Why don't you just write move 100?" She tries it. The cat zooms to the tree.
She screams with joy. The whole class turns around.
In that small moment, she learned something bigger than "move 100 steps." She learned that problems can be broken down, that there's often a smarter way, and that she can make a machine do what she wants.
What does a child really learn in a first coding lesson — and how can parents and teachers make that first lesson a great one?
Coding is not just for future programmers
Some parents ask, "Why should my child learn coding? Not everyone will be a programmer." That's true. Not everyone who learns to write becomes a novelist, either.
Coding teaches a way of thinking called computational thinking. It includes:
- Decomposition: breaking a big problem into small parts.
- Pattern recognition: noticing what repeats.
- Abstraction: focusing on what matters and ignoring what doesn't.
- Algorithms: writing clear step-by-step instructions.
These skills help in maths, science, writing, business and daily life. Planning a trip to the market with a list of stops is an algorithm. Noticing that your mother always cooks rice on Sundays is pattern recognition.
We explored why technology education matters in Why African children should learn to build robots, technology and code.
The number of internet users in Africa has grown fast, but only around 36–38% of people on the continent use the internet. (ITU, Facts and Figures, 2024–2025) Coding lessons in schools can help close the digital skills gap for children who don't have computers at home.
Lesson 1: Computers do exactly what you say
The first big surprise for children is that computers are very obedient — and very literal. If you tell the cat to move 10 steps, it moves 10 steps. Not 11. Not "a bit more because it's obviously trying to reach the tree."
This teaches precision. In everyday life, we give vague instructions ("go get the thing from the place"), and humans figure it out. Computers can't. Children learn to be clear, specific and complete.
A famous classroom activity demonstrates this: the "peanut butter sandwich" exercise. Children write instructions for making a sandwich, and the teacher follows them literally. "Put the peanut butter on the bread" — the teacher places the whole jar on the bread. Laughter guaranteed. Lesson learned.
Joke break (West African version): Ask children to write instructions for making tea. One instruction says "Add sugar." The teacher adds the whole bag. Now the tea is a syrup and the lesson is permanent.
Lesson 2: Mistakes are normal (and have a name)
In coding, mistakes are called "bugs," and fixing them is called "debugging." The word became famous in computing thanks to a story from 1947: engineers working with Grace Hopper on the Harvard Mark II computer found an actual moth stuck in the machine. They taped it into their logbook with the note "First actual case of bug being found."
For children, this is powerful. In many classrooms, mistakes feel shameful. In coding, they're just part of the process. Every programmer, from beginners to experts, debugs constantly.
A child who learns "my code has a bug, let me find it" instead of "I'm bad at this" is learning a life skill: resilience.
"The most dangerous phrase in the language is 'We've always done it this way.'" — Grace Hopper, computer scientist and US Navy rear admiral
Note: Conceptual graphic.
Lesson 3: Big problems are made of small ones
"Make a game" sounds impossible. "Make a character move when you press an arrow key" sounds possible. Coding teaches children to break big goals into small steps.
This skill — decomposition — is useful everywhere: studying for exams, organising an event, starting a business, cleaning a very messy bedroom. Community organisers use it all the time — see A day with a community organiser in Cotonou.
Lesson 4: There's more than one right answer
Two children can make the cat walk to the tree in completely different ways. Both work. One uses a loop; one uses a single big step. One adds a meow sound; one makes the cat dance.
Coding shows children that creativity and logic go together. There are many solutions, and some are more elegant than others. That's a very different message from "there is one correct answer on the exam."
Lesson 5: I can create, not just consume
Most children use technology to watch videos, play games and chat. Coding flips the relationship: now they create.
This can change how children see themselves. MIT professor Mitchel Resnick, who leads the team behind the Scratch programming language, often says children should be not just consumers of technology but creators. Scratch, launched in 2007 and free to use, has been used by tens of millions of young people worldwide to make stories, games and animations.
When a child in Cotonou, Kumasi or Kigali makes a game about their own neighbourhood, with characters who look like them and speak their language, technology becomes theirs.
Tools for a first coding lesson
You don't need expensive equipment. Options include:
- Scratch (free, online or offline version): drag-and-drop blocks, great for ages 8+.
- ScratchJr (free tablet app): for ages 5–7.
- Code.org (free): short, guided activities including "Hour of Code."
- micro:bit (small, low-cost board): code lights, buttons and sensors; good for ages 10+.
- Unplugged activities (no computer): coding games with cards, grids and human "robots."
In places with no computers or unreliable electricity, unplugged coding is a great start. CS Unplugged, developed at the University of Canterbury in New Zealand, offers free activities that teach computer science ideas with cards, string and chalk.
How to run a great first lesson
For teachers and parents, here's a simple 60-minute plan:
- 10 minutes — Unplugged warm-up. One child is the "robot"; classmates give instructions to reach a target.
- 10 minutes — Show the tool. Demonstrate how blocks work. Keep it short.
- 25 minutes — Simple challenge. "Make the character move to the tree and say hello." Let children explore; help only when they're stuck for a while.
- 10 minutes — Share. A few children show their solution. Celebrate different approaches.
- 5 minutes — Reflect. "What was hard? How did you fix it?"
Tips:
- Pair children (one "driver," one "navigator"), and switch every 10 minutes.
- Resist the urge to grab the mouse. Ask questions instead.
- Make sure girls get equal time at the computer. See What girls need to feel welcome in a tech class.
- End on a success, even a small one.
What parents can do
- Be curious. Ask your child to show you what they made.
- Don't worry if you don't know coding. Ask your child to teach you — they'll learn more by explaining. (See The skills students learn when they teach each other.)
- Balance screen time: coding is creative screen time, but active play matters too.
- Look for clubs, holiday camps and school programmes.
Coding in your own language
Most coding tools use English words: "move," "repeat," "if," "else." For many African children, that's a second or third language. Does this matter?
It can. When children must translate and think in code at the same time, the lesson gets harder. Scratch has been translated into many languages, including French, Swahili, Amharic, Yoruba and others, thanks to volunteers. Teachers can also explain ideas in local languages first, then show the code. "Repeat" in Fon, Yoruba or Wolof may make more sense to a child than the English word.
This follows a bigger truth about education: children learn best when they understand the language of teaching. See The value of keeping African stories in local languages.
Five first projects children love
After the first lesson, try these simple projects:
- Talking animal: a character that says hello and asks your name.
- Dance party: characters that move to music when you press keys.
- Greeting card: an animated birthday card for a family member.
- Quiz game: three questions about your town, with a score.
- Market game: a character that "buys" fruit and counts money.
Each one adds a new idea — sound, loops, keyboard control, variables — while staying fun and personal. Children often ask to continue at home. That's the best sign.
From first lesson to future
A first coding lesson won't make a child a software engineer. But it plants seeds: confidence with technology, patience with mistakes, clear thinking and creativity.
Some of those children will go on to join robotics teams (read How to start a school robotics club with one kit), build apps for their communities, or work with AI (see How AI Is Changing Africa). Others will simply think more clearly in whatever they do.
Remember the 9-year-old and her cat? She didn't just move a cartoon. She discovered she could make things happen. That's what a first coding lesson really teaches.
More in our Education section and Technology & Innovation section.
Questions
What age should children start coding?
Children can start with unplugged games and ScratchJr from about 5, and Scratch from about 8.
Do children need a computer to learn coding?
No. Unplugged activities teach core coding ideas with cards, grids and games. Computers help later.
What is computational thinking?
A way of solving problems that includes breaking them down, spotting patterns, focusing on what matters and writing clear step-by-step instructions.
