Knowledge Base

Repeat While Block

output-onlinepngtools__231_.png  This block works for both EV3 Robot and Ruby Robot!  output-onlinepngtools__101_.png

mceclip0.png

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:

  1. 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 ( ≥ ,  ≤ )
  2. Add a condition to check.
  3. 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)

mceclip1.png

 

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!

Was this article helpful?
1 out of 1 found this helpful

Comments

Please sign in to leave a comment.