- Switch Statement: is a type of decision mechanism used to allow the value of a variable or expression to change the control flow of program execution through a multiway branch.
int x = 1;
//if all else then do this…
- At the end of each case you must have a break statement before beginning the next case.
- You must also have a default case, so if the variable value does not match any of the cases, it will execute default.