posted 14 years ago
Hello Gentlemen,
Here is the question #135 in Rule Roundup game:
(#135) In switch construct, default statement will execute if no case values match switch () argument.
True
False
has a "correct" answer True, with explanation:
If there are no matching cases found, the default will run.
This is obviously true, however this is not the only case. Exactly when a case is hit, and the statement under the case and all subsequent cases doesnt have break keyword, the execution will "fall-through" to the default label, if its the last in the switch.
Am I the only one who keeps stepping into this? Maybe the wording of the question should be shuffled around a bit?
Thanks,
Ilya.