Beginner Coding with Blocks
Chapter
>
Level

Loops and Repetition
For Loop

Objective

Walk through the hedge maze to reach exit using a repeat block with no more than six (6) blocks.

In order to get through the maze using no more than 6 blocks, you need to use repeat blocks. This is similar to while loop blocks but functions a bit different, repeat blocks repeat a predefined number of times rather than using a condition like while loop blocks.

Use the repeat block and set the number of times you want to repeat. Place your movement blocks inside the repeat block.

In this example the move forward block (with 2 steps) is repeated 3 times using a repeat block. The number you set in the repeat block determines how many times the blocks inside will be repeated. All blocks you place inside the repeat block will be repeated.

Code book