the loop block
Loops will run or loop everything within it until the condition is met. There are 5 different kinds of conditions. They are seen in the drop down menu beside the word control in the loop’s options:
There is also a check box at the bottom of the loop’s options that says counter beside it. It is present regardless of the control chosen above it. However, it isn’t like the control counter. It only allows you to connect it to other blocks through a data wire and it outputs the number of times the loop has repeated.
To bring blocks into a loop, all you have to do is click and drag a block to the sequence beam line within the loop block. Anything outside the loop won’t be repeated.
The loop block also acts as a wait block in the sense that the entire program will wait for its condition to be met before it continues down the line of blocks. The difference is that while it's waiting on that condition, everything inside the loop will be run over and over again.
- Forever – This will repeat everything within the loop with no end. The program will never end if you use this because it will never be able to exit the loop.
- Sensor – This will repeat everything within the loop until the sensor returns a specific value. Creating this condition is generally the same as the conditions of a wait block.
- Time – This will repeat everything within the loop until a specific amount of time has passed.
- Count - This will repeat everything within the loop a specific number of times. Every time the loop returns to the beginning of the commands within it, it adds one to its count.
- Logic - This will repeat everything within the loop until the loop receives a true value from another block. There is a spot within the loop for you to attach a data wire from a block to the loop. This will allow you to connect other blocks to the loop and the loop will only be broken when the loop receives a true value from that block.
There is also a check box at the bottom of the loop’s options that says counter beside it. It is present regardless of the control chosen above it. However, it isn’t like the control counter. It only allows you to connect it to other blocks through a data wire and it outputs the number of times the loop has repeated.
To bring blocks into a loop, all you have to do is click and drag a block to the sequence beam line within the loop block. Anything outside the loop won’t be repeated.
The loop block also acts as a wait block in the sense that the entire program will wait for its condition to be met before it continues down the line of blocks. The difference is that while it's waiting on that condition, everything inside the loop will be run over and over again.
Back to Intermediate Blocks