The switch/case/default condition expression is evaluated and compared to each case label in turn until a match is found. Subsequent labels will be executed until a break is executed. A default clause will always match. The case expressions do not need to be constants and can be of any type.

switch($response) {
case "hello":

 echo "Hello to you too!";

case "goodbye":

 echo "See you later!";

 echo "I've no idea what you mean!";

Note: The break statement is required to prevent the execution continuing into the next block.

For example:

set v=2;

switch($v) {
case 1:

 echo "v is 1";
case 2:

 echo "v is 2";

 echo "v is not 1 or 2";

Since there is no break at the end of the case 2 code segment, DMScript will continue to execute the code following the "default" clause:

v is 2

v is not 1 or 2

If this is not desired, make sure you include break.