Star Student Builder logoStar Student Builder
← First Steps Lesson 3Std 1-2

Say It Once, Do It Four Times

Four sides of a square means typing the same two lines four times. That is a lot of typing. A repeat does it for you.

πŸ’‘ The idea

A repeat does the same work again and again, so you type less.

  • repeat 4 means do it four times.
  • The work to repeat goes inside the square brackets.
  • repeat 4 [ forward 80 right 90 ] draws a whole square.
  • Change the number in front to repeat more times or fewer.
  • A repeat is called a loop.

πŸ“˜ Words to know

repeat
do the same thing again and again
loop
a piece of code that repeats
brackets
the square marks that hold the repeated work

πŸ‘€ Watch this

A whole square, made by one short line of code.

repeat 4 [ forward 80 right 90 ]
What this program draws
What it draws

✍️ Your turn

  1. Run it and count the sides of the square.
  2. Change repeat 4 to repeat 2. How much of the square is left?
  3. Change 80 to 150 to make a big square.
  4. Try repeat 6 [ forward 60 right 60 ] and see the new shape.

🎯 Challenge: Make a triangle. Repeat three times and turn 120 each time.

Show me one answer
repeat 3 [ forward 100 right 120 ]

Your program
Ask GuruAcharya Samayeshwar