LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Aborting For Loops

I have a for-loop inside another for loop and both those for loops are inside
another for loop. So three for loops in all. What I wondering is, if there
is a way to abort the for loops by using a boolean switch, and without having
to wait for all the loops to complete.

Thanks,

Aaron
0 Kudos
Message 1 of 2
(2,500 Views)
This was just addressed a couple of weeks ago. The concensus was (and i agree)
use a while loop. While loops can be stopped at any time. You can run the
while loop for a determined number of times (like a for loop) by comparing
the iteration terminal to a set (or computed) value.

You can do this in for loops, but it is ugly and not good programming style.
Each iteration, check your boolean, executing one case if go and a do nothing
case if no go. The loop will still execute the set number of times, but
will do nothing from the time the boolean is set until the loop performs
all iterations.

Jared

"Aaron" wrote:
>>I have a for-loop inside another for loop and both those for loops are
inside>another for loop. So three for loops in all. What I wo
ndering is,
if there>is a way to abort the for loops by using a boolean switch, and without
having>to wait for all the loops to complete.>>Thanks,>>Aaron
0 Kudos
Message 2 of 2
(2,500 Views)