Loops allow us to repeat any block or blocks of code we put inside them. There are three kinds of repeat loops in robot See, the first type will keep repeating until you turn the brain off, stop the program or the battery runs out. The second type allows you to set a number of times it will repeat. And the third type allows you to use a sensor value to exit the loop. To demonstrate the differences between the repeat loops, we'll put the same two simple bi VA commands in each of the repeat loops and observe what happens. This repeat forever loop will obviously make the robot drive in a square pattern until we stop it or the battery runs out.
If we use a repeat four times loop, the robot will only drive until it completes the square. And in the last example, the robot will drive in the same pattern. But it will be stopped after the right motors encoder records more than 1080 degrees or five rotations. Note here that the robot won't stop immediately after the encoder records more than 1000 to 90 degrees. The repeat until condition isn't continually checked, it only gets checked every time after that turn right command executes. And therefore the degrees can be quite a bit more than 1080 when the robot eventually stops