R
Roedy Green
For example, this execution model would work for both:
Another way to do it is insist the values of the case variables be
unique. If they are not you get some sort of exception.
Most of the time the values are stable, it is just they have to be
computed once at run time. Perhaps just insisting they have final
values would suffice.
You want to avoid having to implement with nested ifs. You also want
to avoid having to fool around testing the variable case labels every
time you use the switch.