Repeat
Block
It is, of course, much easier to create this script...
...than to create this one:
Even more importantly, using repeat
makes the structure of the program clearer. This is essential to good coding. Clearly structured code is easier to understand and easier to debug (to catch and fix errors). In the longer script above (without repeat
), we'd have to count the parts to see if it's right. And it would be very easy to make a mistake if we were drawing a 20-sided figure instead of a 4-sided one!
Repeat
Block Self CheckThrough how many degrees did your sprite turn altogether when you drew a pentagon?
What's the smallest number you can put into the blank numeric input of the repeat
block below to produce this picture?