Skip to main content

While

Tests to see if the condition is true. If so, then executes the commands attached to the hook. Repeats these commands continually while the condition remains true.

While block

Description

The While block tests to see if the condition is true. If so, then executes the commands attached to the hook. Repeats these commands continually while the condition remains true. This is a code block from the Logic drawer.

Usage

Tests to see if the condition is true. If so, then executes the commands attached to the hook. Repeats these commands continually while the condition remains true.

Syntax

Inputs in this block:

  • A comparative statement block (= statements, > statements, not statement, and/or statements)

Example

Below is a model of growing plants. These plants need rain to fall on them in order to get larger. The while loop controls the weather, dictating whether or not there is a thunderstorm.

While example code
  • Repeat Times - Repeats a specific number of times
  • If - Tests a condition once