We know that loops allow us to do things over and over again, but now we’re going to learn how to use loops that have extra structures built right in. These new structures will allow students to create code that is more powerful and dynamic.
At this point, students have become masters of loops. Today, they will learn about another loop commonly used in programming. The
for loop repeats commands a certain number of times but also keeps track of the values it is iterating over. For example, a
for loop that begins at 4, ends with 8, and has a step value of 1 will repeat 4 times, but the values 4, 5, 6, and 7 will also be captured for use elsewhere. Using this structure with variables can create some pretty fantastic programs. Today, students will simply be learning the basics of a
for loop before diving into programming with them next time!
Students will be able to:
- determine starting value, stopping value, and stepping value for a `for` loop.
- illustrate the counter values hit each time through a for loop during runtime.
Note: You will need to create a free account on code.org before you can view this resource.