LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling program flow and case statements

Hey all, I was wondering, I if I have 40 nested case statements and I want the program to close after they are all done, is it sufficient to wire the "?" for both true and false of the outermost case to the close routine in order to guarantee that all of them will execute? Or is there an even better way using data flow methods?

-Dobbs
0 Kudos
Message 1 of 5
(3,112 Views)
A simple and sure way is to use a Sequence structure - 1st sequence is the cases, 2nd sequence is the exit.
Doug
0 Kudos
Message 2 of 5
(3,112 Views)
I'd recommend state machines better than that way or sequences, to controll dataflow better. Example is attached.
0 Kudos
Message 3 of 5
(3,112 Views)
imho, 40 nested case statements is too many by about a factor of 10. I think anything like this becomes impossible to maintain. State machines can be used much more effectively. If you use strings or enums as inputs to drive the state machine, they are also easier to document.
0 Kudos
Message 4 of 5
(3,112 Views)
Oh I agree. I was just coming up with an extreme example 🙂

Thanks,
-Dobbs
0 Kudos
Message 5 of 5
(3,112 Views)