Loops are a handy tool to automate parts of your program! Let's go through an easy example.

When programming a square path (click HERE to see how we did it using EIGHT programming blocks), you may want to avoid the hassle of adding a long line of Move Steering blocks, primarily because it will save time! This is where loops come in handy.


Rather than your program looking like this....



....you could use a loop to make your program look like this!


Steps

First, select a loop from the orange tab in the LEGO EV3 Programming environment.


Click on the loop and drag it up into the Programming environment. Once it is placed, highlight the programming blocks you want to loop (in our case we only want to loop the first two Move Steering blocks) by clicking anywhere in the white space of the LEGO EV3 Programming environment and dragging over top of the blocks. You will know you've successfully highlighted the blocks when they are outlined in blue like this:

Drag the highlighted blocks into the loop you have already placed. It should look like this:

This program, by default, will repeat indefinitely. If you would like the program to repeat for a certain number of repetitions, seconds, etc., adjust the value in this column: . See more examples below.


                                                                    This loop will repeat three times and then stop.


                                                                This loop will repeat for six seconds and then stop.