Block description

The While block evaluates the block(s) inside its head and executes the contents of the block as long as the condition(s) evaluates to True.
Control exits the While block as soon as the condition(s) ceases to be true.

If two conditions are being checked, logical operators AND and OR can be used to evaluate their combination.

App interface and usage

You can set the type and number of conditions being checked in the block’s head.

While (True):

This enables the While(1) or Forever functionality, identical to the Loop Infinitely block.
While 1

Single condition:

While 2

Double condition:

You can check a maximum of 2 conditions in the head of the block.
While 3

Operator:

Here you can set the operator to be used while evaluating the combination of the conditions in the head of the block.
While 4

Guidelines

• A maximum of 2 conditions can be checked in a single While block.
• If two conditions are being checked, logical operators AND and OR can be used to evaluate their combination.

Examples

This project continuously monitors the on-board IR sensor from the time of upload till power-off or the next project is updated, and turns the LED green while the IR value remains less than 500. It turns it the LED red when the condition is not true.

While Ex

Also read

If
Input blocks