Block description

This block repeats the blocks housed inside it as many times as the loop parameter set in its head. This block is often used to repeat an action (or a set of actions) infinitely by setting the loop parameter to infinity.

App interface and usage

Loop parameter (Number of repetitions):

You can set the number of repetitions for the blocks inside Loop. The number of repetitions can be set from 1 to 99, besides a value of infinity (Loop (forever)
Loop 1
Loop 1

Guidelines

A useful application of this block is when you want the project to run continuously from the time it is uploaded to the board till the board is turned off or a new code is uploaded to the board.
In the absence of this block, the code will run only at the instant of upload and hence its execution may not be observable.

For example:
The below project will run once at the time of the upload.
Loop Guideline
At the instant the project is uploaded to the board, the LED will turn orange and then turn off after a delay of 500 milliseconds. It will then continue to remain off.

However, in the example below, if the same blocks are housed inside a Loop infinitely block, the LED will continue to blink orange and off with a delay of 500 milliseconds between them.
Loop Guideline 2

Example

  1. The below project continuously turns the LED orange and off with each lasting for a duration of 500 milliseconds.

Loop Ex

Also read

Break