Skip to content

Foundations

Working It Out

The computer does arithmetic on values it did not have when you wrote the program, grows a box from its own value, and decides what to do with a leftover.

Begin — Unit 01 →

What this is

Three units on what a computer does with numbers. It works a value out from values it was given. It puts a box’s own value back into the box, larger, which is the line behind every score. And it decides what to do when a sum does not come out evenly, which turns out to be a question every program has to answer.

Who it’s for

Anyone who has finished The Basics. You need to know what a variable is and how to ask the player for a value, because both get used on the first page.

The shape

  • Working it out — arithmetic from values the player types, why * means multiply, and the order sums happen in.
  • A box that grows from itselfLET score = score + 10, the most useful line in any game.
  • When it doesn’t divide evenly — the whole answer, how many fit, what is left over, and rounding.

Next comes Decisions, where a program stops running the same lines every time and starts to react.

The units

  1. 01Working It OutStart →
  2. 02A Box That Grows From ItselfStart →
  3. 03When It Doesn't Divide EvenlyStart →