Skip to main content

Loops

Repeat

The repeat block will run the blocks inside it a certain number of times. You decide how many times it will repeat.

Repeat while/until

This block creates a loop that will run based on the value of a condition.

  • while: The loop will continue to run as long as the condition is true.
  • until: The loop will continue to run until the condition is true.

Condition

  • The condition must be a true or false (boolean) value.
  • It can be a comparison, a variable, or a boolean block.
  • The condition is checked before each iteration of the loop.

For loop

The for block is a more advanced loop that introduces a counter variable that you can use inside the loop.

  • Variable: The variable that will be used as the counter. You can use this variable inside the loop.
  • From: The starting value of the counter.
  • To: The ending value of the counter.
  • By: The amount the counter will increase by each iteration. This can be a negative number to count down.

Control flow

The loop control flow block allows you to exit a loop early or skip an iteration.

  • break out: Exits the loop immediately.
  • continue with next iteration: Skips any remaining blocks in the loop and starts the next iteration.

This block will not work in the setup or forever blocks.