The Switch statement can also be used for type switching to determine the type of variables actually stored in the interface variables. In the programming language, the switch statement variable var 1 can be of any type, while VAR 1 and VAR 2 can be of any value of the same type.
Types are not limited to constants or integers, but they must be the same type; Or the end result is the same type of expression. You can test multiple potentially qualified values at the same time and separate them with commas, such as case val 1, val2, val3 2 and val3.
Language condition
Switch statement is used to perform different actions according to different conditions, and each case branch is unique, and it is tested one by one from top to bottom until it matches.
The switch statement is executed from top to bottom until a match is found, and there is no need to add a delimiter after the match.
By default, case has a break statement at the end. After successful matching, other cases will not be executed. If we need to carry out the latter case, we can use? Failure? .