LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Allowed to not pass default after using case or while loop?

In my program, I'd like to have a simple if statement that says if i get three, pass a three, if i get a four pass a four .. etc. I have tried with while and case loops, but the problem is when it is false it passes a 0, which is the default, and when I try turning the default off I get an error and the program will not run. I wish to disable the default but Labview doesn't like that. Any suggestions?
0 Kudos
Message 1 of 3
(2,798 Views)
you can either, on case structure, right click at case and make current case default, or, to remove default, enter ..1 on case 1, and n.. on case n
0 Kudos
Message 2 of 3
(2,798 Views)
Paul's suggestions are good. Remember that with a numeric there is a very large number of possible inputs to the case structure, and LV has to have them all covered. You see you might know that there will never be (for example) negative number, but the compiler doesn't know that. Hence you have to tell LV what to do if a value less than 0 should appear at its input terminal.

This is why numeric and string case structures almost always end up having a default case. On the other hand, enum case structures often don't have a default case because the enum definition logically limits the possible values the input can take.

So you can use the range functions as Paul suggested, or create a default case that will never be executed. It's up to you.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 3
(2,798 Views)