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 ready to work with numbers. A variable is a named place holding a value. LET puts a value there, ASK reads an answer into it, and SHOW displays a result. We use numbers for the input in these examples.

If those ideas are new, The Basics gives them more room. You do not need to have followed a particular language course.

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 itself — LET 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.