Creating While Loops

The While Loop executes the subdiagram while the conditional terminal receives a specific Boolean value.

Complete the following steps to create a While Loop.

  1. Place the Functions»Structures»While Loop on the block diagram.
  2. Add block diagram nodes inside the While Loop to create a subdiagram that the While Loop repeats. You typically add a Boolean control, such as a STOP button, to the subdiagram to control the iteration of the While Loop.
  3. Wire the Boolean value to the conditional terminal of the While Loop. By default, the conditional terminal is set to Continue If True. You can change the behavior of the conditional terminal through its shortcut menu.

Because the VI checks the conditional terminal at the end of each iteration, the While Loop always executes at least one time. The VI does not run if you do not wire the conditional terminal.

You can prevent code execution in the first iteration by placing a Case structure inside the loop.