The "Repeat Until" Block
-
Prerequisite
Description
The “repeat until” block is a C block with boolean input in the control category.
How does this block work?
This block will keep repeating the blocks inside it until a condition becomes true. In other words, this block will check the condition first, and if the condition is not true, it will run all the blocks inside its "mouth’ once, then it checks the condition again. If the condition is still not true, then the blocks inside will run again …
If the condition is already true
If the condition given to the “repeat until” block is already true, then the blocks inside will NOT run at all.
Animation with “Repeat until” Block
Here is how you can create an animation with repeat until block. Since the butterfly is not touching the flower, the condition is false for the repeat until block in the beginning. Therefore, the blocks inside will make the butterfly move down repeatedly. When the butterfly becomes touching the flower, the condition becomes true. At that time, the blocks below the “repeat until” block will run instead.