Terminals inside or outside Loops

Inputs pass data into a loop at the start of loop execution. Outputs pass data out of a loop only after the loop completes all iterations. If you want the loop to check the value of a terminal on each iteration, place the terminal inside the loop.

When you place the terminal of a front panel Boolean control inside a While Loop and wire the terminal to the conditional terminal of the loop, the loop checks the value of the terminal at every iteration to determine if it must iterate again. You can stop the While Loop shown in the following example by changing the value of the front panel control to FALSE.

If you place the terminal of the Boolean control outside the While Loop, as shown in the following example, and the control is set to FALSE if the conditional terminal is Stop If True when the loop starts, you cause an infinite loop. You also cause an infinite loop if the control outside the loop is set to TRUE and the conditional terminal is Continue If True.

Changing the value of the control does not stop the infinite loop because the value is not propagated until the loop stops and you run the VI again. To stop an infinite loop, you must abort the VI by clicking the Abort button on the toolbar.