Loops allow us to eliminate redundancies in our code. If there are code blocks which get repeated, we can use the loop blocks to force the repetition without having to replicate the blocks used.
For all of our activities, make sure your practice with the new blocks today. Some of the activities you can complete without using the new blocks. They do save some time and headaches. Open up the Practice Area, and take a crack at the following activities.
Create a blockly program which uses variables Num Sides, Circumference, Turn Angle, and Side Length to draw a polygon on the turtle pond. Num Sides can be any positive number you want, and Circumference can as well. The value of Turn Angle should be determined by Num Sides through some mathematical expression, and the value of Side Length should be determined from Num Sides and Circumference.
Your program should draw a polygon with the specified number of sides with the correct circumference specified. You will need to use a loop in your program!
All of the following parallelograms were drawn using 400 as the Circumference, and changing the number of sides. You do not need to match any of these pictures to get checked off, but your could should be able to generate these with the correct values.
Create a blockly program which will be able to draw a spiral as shown in the image below. You must use a loop, but how you increase the length of each side is up to you.