A switch statement is meant to be used in place of if else statements
For example
int a =4;
if(a == 1)
    doSomething();
else if(a == 2)
    doSomethingElse();
else if(a == 3)
    BLAH();
else
     CaseUnaccountedFor();
Is equivalent to
int a =4;
switch(a) {
case 1:
    doSomething();
    break;
case 2:
    doSomethingElse();
    break;
case 3:
    BLAH();
    break;
default:
   CaseUnaccountedFor();
    break;
}
If one of the cases is a match, the switch statement is not automatically exited which is why there’s a break statement at the end of each case. The case ‘default’ matches every other case besides the ones you explicitly list.
1
solved Can someone explain switching in Objective C [closed]