Thinking in Code
Math · Foundational · Lesson 7 of 9

Boxes with Names

Variables and assignment

An interactive lesson with 6 steps, about 5 minutes: you predict, drag and solve, with instant feedback on every answer. It runs in your browser and needs JavaScript.

What you’ll learn

  • A variable is a named box; “x = …” puts a value in it.
  • The right side is worked out first, using current values.
  • Assigning copies a value; overwriting destroys the old one.

Steps

  1. Variables
  2. A copy, not a link
  3. Swapping two boxes
  4. Work backwards
  5. Squaring again and again
  6. A swap without a spare box