Tutorpip← About this lessonOpen the sheet →Download PDF
Ages 8+ · Coding · Build a project
Draw with code
1pen down2repeat 4 times3 move 100 steps4 turn 90 degrees
Move and turn, repeated, draws a square.
The big ideaA shape is move and turn, repeated, and a square turns ninety degrees four times.

How it works

A pen block draws a line as the sprite moves. Pen down means draw, and pen up means move with no line.

A shape is move and turn, repeated. A repeat block draws all the sides with just a few blocks.

A square corner is 90 degrees, and a full spin is 360 degrees. Four turns of 90 degrees make one full spin.

The turns of a closed shape add up to 360 degrees. When the turns make a full spin, the line closes.

Turn 80 degrees• four turns: 320 degrees• less than a full spin• a gap is leftTurn 90 degrees• four turns: 360 degrees• a full spin• the square closes
A turn that is too small leaves a gap.

Example 1: A square

  1. The stack says repeat 4 times: move 100 steps, then turn 90 degrees.
  2. Four turns of 90 degrees: 4 × 90 = 360.
  3. That is a full spin, so the last line meets the first and the square closes.

Example 2: A gap

  1. Noor's first stack turns 80 degrees at each corner.
  2. Four turns of 80 degrees: 4 × 80 = 320.
  3. 320 is less than a full spin of 360, so there is a gap.
  4. The mix-up to fix: change 80 to 90.

Example 3: A triangle

  1. Repeat 3 times: move 100 steps, then turn 120 degrees.
  2. Three turns of 120 degrees: 3 × 120 = 360.
  3. A full spin, so the shape closes with three sides.

Example 4: A hexagon

  1. Repeat 6 times: move 100 steps, then turn 60 degrees.
  2. Six turns of 60 degrees: 6 × 60 = 360.
  3. A full spin, so the shape closes with six sides.

Words to know

sprite
A character you move with blocks. Noor's was a little pencil.
pen down
A block that makes the sprite draw a line as it moves.
degrees
A way to measure a turn. A square corner is 90 degrees.
repeat block
Does the blocks inside it again and again.

Watch out

Try it

  1. Does pen up draw a line as the pencil moves?
  2. How many degrees is a full spin?
  3. A square turns 90 degrees at each of 4 corners. How many degrees is that in all?
  4. Which closes a square: turning 80 degrees four times, or turning 90 degrees four times?
  5. A triangle uses 3 turns of 120 degrees. What do they add up to?
Answers: 1. No · 2. 360 · 3. 360 · 4. Turning 90 degrees four times · 5. 360
Try at homeWalk a square on the floor: take four steps, turn a quarter turn, and repeat four times. Then try turning a smaller turn and see where you end up. Count the turns: four quarter turns make one full spin.
For grown-upsDo the Mission: mark a square on the floor with chalk or string and walk it together: four steps, a quarter turn, and repeat four times. Then try a smaller turn and see where you end up.
Open these notes on screenScan the code, or go to tutorpip.com.