Trace & Predict
Thinking It Through · computational thinking · read a program line by line to predict what it prints

Kavi Reads the Program First
Before Kavi pressed ▶ Run, Kavi tried something clever: reading the program first. "If I read each line in order," said Kavi, "I can tell what it will print before I even run it!" The program started score = 2, then added 3, then took 1 away. Kavi pointed at each line and kept the number in mind: 2… 5… 4. "It will print 4," Kavi predicted. Then Kavi ran it — and the screen said 4! "Reading a program and working out its answer is called tracing," Kavi hooted, "and a good coder can predict the output every time."
What your child will learn
A peek inside
Try this at home: Reading a program line by line to work out its answer is called ____.
Ready to play and learn?
Start the free interactive lesson, or print the handout for screen-free play.
Part of Computing · Stage 4 · S4 on KAVI Academy — a secular, whole-child learning platform for ages 5–12.
