By Kevin McAleer, 4 Minutes
Page last updated November 20, 2026

A square is the same every time round the loop. To draw something that changes as it goes, the program needs to remember a number. That’s a variable.
A variable is a named box that holds a value. A robot might keep its speed in one, or a game might keep the score. You can look in the box, and you can put something new in it.
Open the Variables drawer. The first thing in it is Create variable…. Click it and type size.

Three new blocks appear on the shelf:
Every variable you create gets its own blocks here, so you never have to hunt through a dropdown.
A spiral is a square where every side is a bit longer than the last.
10.size + 10.

size = 10 is set size to 10. In Python a single = means “put this value in the box”turtle.forward(size) uses whatever is in the box right nowsize = size + 10 looks odd if you read it as maths. Read it as an instruction: work out size + 10, then store the answer back in sizeEach time round the loop, size goes 10, 20, 30, and the sides get longer.
You’ve now used both shapes of block:
| Shape | Job | Example |
|---|---|---|
| Jigsaw (notch on top, bump below) | Does something. Stacks with others | move forward, set size to |
| Round | Is a value. Fits into a socket | size, 10, size + 10 |
| Pointed | Is true or false. Fits into a pointed socket | size > 100 |
If a block won’t go where you want, it’s usually the wrong shape for that socket. That’s the blocks stopping a mistake before it happens.
Maths has the sums (+, -, ×, ÷), random integer, round, and more. The + block has a dropdown, so one block can do any of the four sums.
90 to 91. What happens to the spiral?angle and use it for the turn.Problem: NameError: name 'size' isn't defined
Solution: Put set size to above the loop, so the variable exists before it’s used.
Why: Python reads from the top. It can’t look in a box that hasn’t been made yet.
Problem: The spiral is just a square.
Solution: Check the last block in the loop sets size to size + 10, and that it’s inside the repeat.
Why: If size never changes, every side is the same length.
Quick quiz 1 of 3
What does size = size + 10 do?
size.Quick quiz 2 of 3
What shape is a block that gives a value?
Quick quiz 3 of 3
Where do you make a new variable?
You can use the arrows ← → on your keyboard to navigate between lessons.
Comments