Lesson 4: Project Flow with Nested Loops
With nested loops, the project flow can seem overwhelming. The project begins by checking the repetitions or conditions of the outer loop and then triggering the inner loop to begin.
The inner loop executes until all repetitions are completed or the condition is met, before returning back to the outer loop. This cycle repeats until all repetitions of the outer loop are completed or until the condition of the outer loop is met.
In the example below, the project begins by starting the first repetition of the outer loop. In this case, the outer loop repeats three times.
- The first [Repeat until] block is the first inner loop.
- The first inner loop will run until the condition is reported as TRUE. The project will then break from the first inner loop and begin moving through the rest of the blocks inside of the outer loop.
- This continues until the second [Repeat until] block begins. This is the second inner loop.
- The blocks inside of the second inner loop will repeat until the condition of the block is met. The project will then break from the second inner loop and begin moving through the rest of the blocks inside of the outer loop.
- Once all the blocks in the outer loop are complete, the project goes back to the beginning of the outer loop and repeats the process again.