Adding a For Loop

Self-Check

Why did we use a for loop in this program?

Since we knew the number of times we wanted Edison to repeat the sequence (four), a for loop is the best choice. Using a loop made it much easier for us so that we didn’t have to type out the same sequence over four times. This leaves less room for error, saves time, and is more succinct!

Practice

  • Create your own for loop (or loops!) to repeat a section of your dance.
  • Can you use math to manipulate the moveSpeed variable?