>>40386880>>40386894sadly, yes
>>40386998a switch statement tells the program what to do depending on the value of a specific variable. so imagine your mom gave you treats based on how many answers you got right on the math test, if you got all 4 correct you get an ice cream sundae, if you got 3 correct you get a cupcake, for 2 you get a lollipop but if you got 1 or 0 answers right you get gruel. assuming a lot of logic and data validation already took place you could write out that process with something like this
switch(number_of_correct_answers) {
case 4:
treat = ice cream sundae;
break;
case 3:
treat = cupcake;
break;
case 2:
treat = lollipop;
break;
default:
treat = gruel;
break;
}
the default label denotes instructions that will take place if the value in the switch() doesn't meet any of the given cases. so if you got 0 or 1 answers correct you don't need to make cases for that you can just put it under default. (yes you'll still get gruel for -248 correct answers but i'm trying to simplify this as much as i can and i already mentioned pre-existing data validation). you can infer that making a switch statement with only a default block and nothing else does nothing because what you're asking the computer to do is "hey so if the thing in the switch() doesn't meet any of the listed cases, do this." and then you don't list any cases, meaning the default block will always trigger no matter what. that's exactly what pirate software did here.