G
Guadala Harry
After RTFM, I hope I have missed something: I would like to have a switch()
statement process multiple input values the same way - but without having
multiple case: blocks for multiple input values that need to be processed
the same way. For example, please consider the following sample switch block
and notice that "other value 1, 2, and 3" all execute DoOtherThing(). How
can I get all of those [case "other value x"] cases to NOT have to appear in
their own case block?
switch (someString) {
case "one value":
DoOneThing();
break;
case "other value 1":
DoOtherThing();
break;
case "other value 2":
DoOtherThing();
break;
case "other value 3":
DoOtherThing();
break;
case "other value 4":
DoOtherThing();
break;
default:
GiveUp();
break;
} // end switch
Thanks!
-G
statement process multiple input values the same way - but without having
multiple case: blocks for multiple input values that need to be processed
the same way. For example, please consider the following sample switch block
and notice that "other value 1, 2, and 3" all execute DoOtherThing(). How
can I get all of those [case "other value x"] cases to NOT have to appear in
their own case block?
switch (someString) {
case "one value":
DoOneThing();
break;
case "other value 1":
DoOtherThing();
break;
case "other value 2":
DoOtherThing();
break;
case "other value 3":
DoOtherThing();
break;
case "other value 4":
DoOtherThing();
break;
default:
GiveUp();
break;
} // end switch
Thanks!
-G