|Download Help (Windows Only)|
Owning Palette: Structures
Requires: Base Package
Repeats the subdiagram inside it until the conditional terminal, an input terminal, receives a particular Boolean value. The Boolean value depends on the continuation behavior of the While Loop. Right-click the conditional terminal and select Stop if True or Continue if True from the shortcut menu. You also can wire an error cluster to the conditional terminal, right-click the terminal, and select Stop on Error or Continue while Error from the shortcut menu. The While Loop always executes at least once.
The iteration (i) terminal provides the current loop iteration count, which is zero for the first iteration. If iteration count exceeds 2,147,483,647, or 231-1, the iteration terminal remains at 2,147,483,647 for all further iterations. If you need to keep count of more than 2,147,483,647 iterations, you can use shift registers with a greater integer range.
If you select a While Loop on the Execution Control Express VIs and Structures palette and place it on the block diagram, a stop button also appears on the block diagram and is wired to the conditional terminal. If you select a While Loop on the Structures palette and place it on the block diagram, a stop button does not appear.
After you create a While Loop, you can use shift registers to pass values from one iteration to the next. If you wire an array to a While Loop, you can read and process every element in that array by enabling auto-indexing.
To convert a While Loop to a For Loop, right-click the While Loop and select Replace with For Loop from the shortcut menu. (ETS, VxWorks, Windows) To convert a While Loop to a Timed Loop, right-click the While Loop and select Replace with Timed Loop from the shortcut menu.
Refer to the Generate Random Signal VI in the labview\examples\general\structs.llb for an example of using the While Loop.