To draw a square with side length 100, we write in the editor:
to square
repeat 4 [forward 100 right 90]
end
We just have to modify this procedure by doing:
- We add :c at the end of the definition line. This indicates that the procedure is now waiting for an
argument called :c
- We replace the side length 100 by the variable name :c
We obtain
to square :c
repeat 4 [forward :c right 90]
end
Therefore, if we write: square 100 square 50 square 30 square 20 square 10