The switch-case statement is like a list of if statements which all compare a single variable with a bunch of possible matches.
The
label defines the code which is run when none of the cases matched the variable in the switch.
Example
- Code:
switch(variable)
{
case 0:
// do this if this matches this case
break;
case 1:
// do this if this matches this case
break;
default:
// do this if no other case was true
break;
}
- Code:
break;
The
- Code:
default:
label defines the code which is run when none of the cases matched the variable in the switch.
Example
- Code:
switch(self.stage)
{
case "dome_mp":
self iPrintlnBold("Wallbanging <3");
break;
case "lockdown_mp":
self iPrintlnBold("Shitty spawns!");
break;
default:
self iPrintlnBold("Idc!");
break;
}