The Repeat Loop
Now that we know a lot about FMSLogo itself, it's finally time to have fun with one of the most simple loops:The Repeat Loop. But before we get into it, what is a loop? A loop is a set of certain code that can be looped (repeated) as many times as wanted until the requirement is true(1), and not false(0). So, the REPEAT loop repeats a certain action in brackets [] as many times as we want it to repeat. This has so many uses, but let's look at our simple square we made last lesson. It contained 4 lines of code in which every single said "FD 100 RT 90". Well, with the REPEAT loop, we can change the code to REPEAT 4[FD 100 RT 90]. We write repeat in the Edall program, then the number of times we want a certain action to repeat itself, and then in brackets write what we want to repeat. This mekes FMSLogo programming so much easier and more simple, as well as much more fun than just endless writing of the same line of code. As shown in the picture, we have an example of the REPEAT loop in a square as well in a triangle program. Tip: If you want to find out an angle required to draw a certain shape (e.g.Triangle) You can divide 360 degrees by the number of angles that a shape has (360:3 because a triangle has 3 angles) This time, try to draw a hexagon using the repeat loop! Now that we know what's a REPEAT loop, let's learn about simple and multiple simple variables in the next lesson!