ConceptsAll the ideas

Rule Machines

Idea 17of 23Builds onIF … ELSE picks one of two pathsPredict before you run

Change one number, see what changes

When you change code, which outputs change?

Today you'll discover

  • how to alter one number
  • how to find which outputs change
  • how to describe the effect

Think firstThe ticket machine: 20 becomes 10

The 20 in the condition becomes 10. Which outputs change?

Decide first, then press Next. Find the one changed line, then check each input.

Two versions of the ticket machine side by side: IF number > 20 and IF number > 10, the changed line framed. A table of inputs 4, 12, 24 and 30: before 8, 24, 29, 35; after 8, 17, 29, 35, with only 12 marked changed. The last step asks how changing REPEAT 3 TIMES to REPEAT 5 TIMES changes the output of SET 2 and ADD 4.

See the whole ideathe big idea and the key word, in one place

The big idea

Alter one part of the code, run it again, and describe which outputs changed and why.

The effect, in wordsMoving 20 to 10 changed only 12, from 24 to 17. 4, 24 and 30 gave the same outputs as before.

Easy to get wrongDo not guess that everything changed. Run every input again and compare each output.

Key word

alter
to change part of existing code, such as one number or one line

Ready to use it?

  • Describe how a change to the code changes its outputs.
Practise this idea