Lecture 7 (Edwards) - Loopty Loops!

Lecture Date: Wednesday, February 4

As you might remember from the turtle exercise, there are instances that we want to run the same section of code several times (for example creating squares or shapes with our turtle).

One way to have code repeated is with loops. There are 3 types of loops that we will be focusing on:

  • for
  • while
  • do while

Here is the conceptual idea behind a for loop.

for loop

Example Code: