The current behavior of a zero iteration For Loop with data that passes through it is shown below. The value passed out of the loop is the default value for the data type rather than the data itself.
If you do not want this behavior, you must replace the border tunnels with a shift register. My suggestion is to change the current behavior and instead pass through the actual data rather than the default data type value if a For Loop iterates zero times. Many LabVIEW developers, especially newer ones, are not even aware of the current behavior, which can lead to bugs in software using For Loops.
Obviously the picture above is a contrived example, but this situation can occur quite easily if an auto-indexed array is wired to the left border of the For Loop and the array is empty at run-time with other pieces of data being passed through the loop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This would be a language-breaking change. The bar for making these kinds of changes to LabVIEW is incredibly high, and would require an immense benefit relative to the work required to mutate existing code to account for the new behavior. The existing behavior is documented, and tools exist for detecting the problematic pattern described in the original post, including the 'Unused Code' test in the VI Analyzer Toolkit.