Skip to content
Spark & Whetstonethe grown-up commons

← Reading Code · Lesson 1 of 3

Predict, then run

About it

A program is a list of steps the computer follows from top to bottom. A variable is a named box that holds a value, and a line like x = x + 2 means "take what is in x, add 2, and put the result back in x".

Before running anything, predict what it will print. Then check. The gap between your guess and the result is where the learning is.

Try: x = 3, then x = x + 2, then print x.

One question

x = 3, then x = x + 2, then print x. What is printed?

Say it back
A lesson is kept once you've answered the question and written at least 8 words. Nobody grades it; it stays on this device.