Skip to content
Spark & Whetstonethe grown-up commons

← Reading Code · Lesson 2 of 3

Keep a table

About it

When a program has more than one variable, keep a small table on paper: one column per variable, one row per line. Write the new value each time a line changes it.

For a = 2, b = a × 3, a = b − 1, the table goes: a is 2; b is 6; a becomes 5.

One question

a = 2, then b = a × 3, then a = b − 1. What is a at the end?

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.