Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 2 of 8

Changing what is in the box

Show on a big screen

5 min

Text size

A box holds 0. Each tap must make it bigger by one.

score holds 4.
Step 1 of 3
  1. score holds 4.
  2. Read 4. Work out 5.
  3. Write 5 back. The 4 is gone.

The block says add 1 to score.

The first run changed the box from 4 to 5. Start the block again and the box holds 6, not 5. The second run starts from 5, so 5 + 1 = 6.

Rule: An add block reads the number in the box. It works out the new number. It writes that back.

A repeat block runs its inside blocks a set number of times. Put an add block inside it. The box starts at 0. Repeat 4 times, add 3: the box holds 3, 6, 9, 12.

Watch out!

score = score + 1 is not a Maths equation. It is an order: read the box, then write the new number.

Slide the two numbers. Make score end at 12.

Loading lab…

Try the lab to finish this lesson.