QUOTE (geniusalz @ Feb 7 2004, 08:18 PM) |
It's even redundant (sort of, not from a technical perspective, but logically) in the other case 'blocks'.
Switch 5 CASE 1 blah ENDCASE CASE 2 blah ENDCASE CASE 3 blah ENDCASE ENDSWITCH
What I'm saying here is that instead of looking for an ENDCASE to end the 'block', look for a CASE or ENDSWITCH statement, like this:
Switch 5 CASE 1 blah CASE 2 blah CASE 3 blah ENDSWITCH |
Oh no.... that's not right.
ENDCASE forces execution to jump to the ENDSWITCH statement.
If you leave out the ones in your example, execution will proceed through the other case statements. This is on purpose, as you can provide multiple cases for a single block of code.
CODE |
SWITCH %something% CASE 1 CASE 2 blahRed ENDCASE CASE 3 DEFAULT blahBlue ENDCASE CASE 4 blahGreen ENDSWITCH
|
Even the above example has a problem... can you guess what it is? But the example is also to show that in the case of 1 and 2, blahRed will get executed. 3 and everything else, blahBlue will get executed.