With this block you can repeat commands multiple times. Place the blocks to be repeated inside the loop. As soon as the program has accomplished the last block in the sequence, it will restart with the first block.

Options:

  • The number of times the block or sequence of blocks should be repeated

Example:

This example writes three times Hello! on the matrix.


With this block, you can add a condition to a loop. As long (or until) as the condition is true, the blocks inside the loop will be repeated.

Options:

  • while: The loop will be repeated as long as the condition is true. As soon as it changes to false, the program goes to the first instruction after the loop.
  • until: The loop will be repeated until the condition is true. This means that the blocks will be repeated as long as the condition is false. As soon as it changes to true, the program goes to the first instruction after the loop.


With this block you repeat a sequence of command blocks, and with each repetition, you change the value of a variable.

Example:

In the first loop, i is 0, then, after each loop it is increased by 1, until it reaches 4. In each loop, we use the value of i to switch on an LED in the matrix, then wait 0.5 seconds.


This block needs to be placed inside a loop. It can, for instance, be bound to another condition. As soon as the block is reached, the program jumps to the first instruction after the loop.

  • en/programmingblocks/loops.txt
  • Last modified: 2018/06/07 13:02
  • by kniwwelino