This block works for both EV3 Robot and Ruby Robot!
The Repeat While Block repeats a single block or multiple blocks in a loop while or until a condition is true. It’s that simple.
To apply the Repeat While block to a program:
- Select whether to repeat the loop while or until a condition is true (=) , or to repeat the loop while or until the condition is false (≠). You can also select greater than/smaller than ( ≥ , ≤ )
- Add a condition to check.
- Insert a single block or multiple blocks to repeat in a loop.
Example code:
This loop will continue to run the Drive block in a turn, while the gyro sensor's readings show a value smaller than 50. Once it gets there - the loop will end and the robot wills top (Drive block with 0 power)
Configuration
Parameter | Description | Configuration | Compatible Blocks |
repeat |
Blocks are repeated in a loop while or until a condition is true. Add a condition after the Repeat while/until parameter. |
While: While the condition is true, the commands that follow the do parameter are executed. Until: While the condition is false, the commands that follow the do parameter are executed. |
|
Hints and Tips
You can configure the Repeat While block to repeat while true to repeat commands indefinitely!
Comments
Please sign in to leave a comment.