den:
Default case processing is REQUIRED in ANY language that processes
case structures whether it is LabVIEW, Fortran, Basic, C or any other
language you ever heard of.
Think about it logically, a case structure is a elementary branching
operation. The computer has come to a fork in the road, it has to
make up it's mind what to do next. It has either to go left or go
right. It HAS to do one or the other.
If all the cases aren't covered and the computer gets case data that
isn't covered by the programmer enumerated cases, THEN WHAT DOES IT
DO? QUIT? It HAS to know what it is going to do next with unexpected
data. Computers (at least in in the non-AI world), unlike people,
don't improvise solutions to unexpected situations on their own, they
can only follow their program written the programmer (you).
With simple true-false cases we don't think about this much because
the sum of the true and false cases comprises ALL the possible cases
which can exist for a boolean case structure, so there are no
unexpected data cases and thus there is no need for a separate
"default" case in this one special circumstance. With all other data
types (strings, numbers, etc.) there are an infinite number of
possible cases.
Create a boolean case structure and try to remove the false case (or
the true case). You can't do that for the same reason that you can't
remove the default case for other data types without getting an error.
It leaves the computer in a situation where the computer doesn't know
what to do for some possible results.
The If or If-then-else structures that many people use are just
boolean case structures where either the false case is implicit (if
then with no else block version) and nothing is done for the false
calse, or false is explicitly defined in the else block.
So you see then, there ALWAYS has to be a default case to cover
catch-all situations not emumerated by the programmer for these
non-Boolean data types.
You usually don't have to do ANYTHING in the default case. It just
has to exist. Some people may use it to report an error back to the
user like "Unexpected data encountered" or something similar.
Do you remember the pop song "Did You Ever Have To Make Up Your Mind"
? "You better go home son and make up your mind..."
Douglas De Clue
LabVIEW programmer
ddeclue@bellsouth.net
den wrote in message news:<50650000000800000067520000-1023576873000@exchange.ni.com>...
> In Dynamic Menu Insertion the case structure in the while loop, shows
> always default case.I don't like it
>
> I've modified a VI that is Dynamic Insert Demo (examples). When VI
> runs, Front panel shows default case. Choosing another item it appears
> for few seconds ad after appears default case item. Why can i remove
> default case in case structure?