For Loop
- Updated2025-01-28
- 5 minute(s) read
For Loop
Executes its subdiagram n times, where n is the value wired to the count (N) terminal. The iteration (i) terminal provides the current loop iteration count, which ranges from 0 to n-1.

Terminal Inputs

This terminal is displayed by default.

You can use the input of the parallel instances terminal and the Number of generated parallel loop instances in the For Loop Iteration Parallelism dialog box to improve For Loop performance by oversubscribing or undersubscribing.
To display this terminal, enable parallel For Loop iterations.

To display this terminal, programmatically configure the loop iteration schedule.

By default, the conditional terminal is set to Stop if True. You can change the behavior of the conditional terminal to Continue if True.
To display this terminal, set the For Loop to stop when a condition occurs.
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
Single-Cycle Timed Loop | Limited support. You can place a For Loop in a single-cycle Timed Loop if the For Loop contains only Array, Numeric, Boolean, or Comparison operations and uses only auto-indexed tunnels. Objects that generate or contain state, such as shift registers, Feedback Nodes, or VI calls, are not allowed in For Loops within a single-cycle Timed Loop. |
Usage | The iteration (i) terminal is a 32-bit signed integer that saturates on reaching its maximum value, 2^31 - 1. The conditional terminal is not supported. Parallel loop iteration is not supported. |
Timing | The For Loop incurs two clock cycles of overhead between iterations. If the For Loop contains initialized shift registers, it takes one clock cycle before the first iteration to initialize shift register values. |
Resources | The For Loop consists of a small state machine. Shift registers require FPGA resources in proportion to the width of the data type. Loop auto-indexers consist of a hidden shift register for each array element. |
Notes | The LabVIEW FPGA Module supports only one-dimensional arrays that resolve to a single size at compile time. If LabVIEW cannot infer a single size for an array, you may need to manually configure the array to a fixed size. |
Terminal Outputs


This terminal is displayed by default.

- Number of Instances—Number of loop instances LabVIEW is running in parallel. This number is the minimum of the value wired to the parallel instances terminal and the Number of generated parallel loop instances in the For Loop Iteration Parallelism dialog box.
- Current Instance ID—Numeric identifier between 0 and P–1 assigned to the loop instance that is executing the current iteration.

For Loop Tunnel Inputs
Loop tunnels allow you to pass data through the For Loop. You can change the tunnel mode to handle data that passes through the For Loop in different ways, as listed in the following table.



For Loop Tunnel Outputs
You can configure the For Loop to return the last value of the last loop iteration, an indexed array of every value generated by the loop, or a concatenated array of every value generated by the loop by right-clicking the loop output tunnel and selecting Tunnel Mode from the shortcut menu.