Computing · Stage 2

Predict the Program

Building Blocks · read a program and say what it does before you run it

✦ Computing📘 Stage 2 · S2⏱ ~10 min🧒 Ages 6–7★ Free to start
I can read a program and predict what it does.
Kavi the owl for Computing
📖

Kavi Reads Before Running

Kavi looked at a little program on the screen. "Before I press Run, let me read it line by line and guess what it will do," said Kavi. "Set score to 2... add 3... that's 5! I bet it prints 5." Kavi pressed Run — and the screen showed 5! "Reading a program and saying what it does is called predicting. A program has no surprises — it does exactly what each line says, in order."

🎓

What your child will learn

1What will this program print?A program runs one line at a time, in order. Read each line, keep the score in your head, then reveal to check.
2Will this line make the score go up or down?To predict the end, read what each line does to the score. An add line makes it bigger. A take line makes it smaller. Tap the right box.
3Read the program, then press RunA good coder reads every line and predicts the end before pressing Run. Read these lines out loud, guess what it prints, then press Run to check.
🔍

A peek inside

A program: set score = 3, then add 2 to score, then print score. What does it print?
start at 3, add 2 → 3 + 2

Try this at home: Reading a program and saying what it does is called what?

Ready to play and learn?

Start the free interactive lesson, or print the handout for screen-free play.

Part of Computing · Stage 2 · S2 on KAVI Academy — a secular, whole-child learning platform for ages 5–12.