10. Loops

You must first complete 9. Color Sensor before viewing this Lesson

10.1. Repeating an action

Let’s say we want the robot to repeat an action over and over again. Would you just copy the block multiple times? What if I want to repeat that block forever?

Loops make repeating a task multiple times easy
The added benefit is that a loop can end whenever you want (a specific number of times, run forever, a specific condition, etc)

Challenge 1
Write a program to go around a box once.
The simple way is to code it like this:

Use a loop to improve the code

Back to: Module 3. Programming