Code a drawing
Give a turtle commands to move and turn, and draw shapes. Use loops to draw more with fewer lines.
The activity
Challenge 1 of 9
Square
Draw a square with sides of 100. The first side is done for you.
Show a hintHide the hint
A square has 4 equal sides and 4 square corners, so each corner is right 90. Then try repeat 4 [ forward 100 right 90 ] to do it in fewer lines.
Press Run to see what your code draws, or Step to run it one command at a time.
One command on each line, or several with spaces between. Anything after # is a note the turtle ignores. Ctrl + Enter runs your code.
What you'll practise
- Sequencing instructions
- Loops and nested loops
- Finding and fixing bugs
For teachers and parents
Work through the nine challenges in order. Before pressing Run, ask learners to say what the program will draw, then use Step to check one command at a time. Code is saved on the device, so a learner can come back to it.
In the curriculum
In the Coding and Robotics CAPS for Grades 4 to 6, which schools are phasing in from 2026 to 2032, Grade 4 learners write the steps to draw a square and then shorten them with a repeat loop, and the CAPS progression for Grades 4 to 9 goes on to drawing shapes with loops and nested loops. Source (PDF)
Part of Teachist's Robotics and programming program