Iteration opens up a large number of potential assignments and activities. With iteration and conditions, students can program their robots to perform simple behaviors like seeking bright light, avoiding obstacles, or always driving uphill. When considering the creation of an assignment that uses iteration, it is helpful to consider the inputs and outputs of the Finch and computer:
Iteration allows for one or more of these inputs to be linked to one or more output in a dynamic way, such that changes in the input result in changes to the output. For example, we can create a smart alarm clock program that uses the data from the light sensor and the computer clock to wake us up through movement and sound at a specified time only if the room is dark. Some of these assignments have already been created, but a nearly limitless number are possible simply by combining the inputs and outputs in interesting ways.
Breaking out of the Loop
The large number of inputs provides for a number of possible events that can be used as conditions to break out of a main loop and end a program. An example condition is isBeakUp, which returns true when the Finch is placed on its tail. This is a natural action at the end of a program where the Finch is moving around on the table or floor.