The switch statement allows you to test when a variable is equal to multiplevalues. In the Swift language, as long as the match to The syntax of switch statements in the Swift language: It is generally not used in switch statements We need to pay attention to this. If used case statement,the entire switch statement is executed. 9.15.1. Grammar #
switch expression { case expression1 : statement(s) fallthrough /* optional */ case expression2, expression3 : statement(s) fallthrough /* optional */ default : /* optional */ statement(s); }
fallthrough statement. case if you do not use the fallthrough statement, the current case statement, the switch terminates and the control flow jumps to the next line after the switch statement. fallthrough statement, the execution of the case or default statement that is executed regardless of whether the condition is met or not.