C# Switch Statements in Unity
What are switch statements and when to use them
Switch statements work like a series of if else statements. When checking the same variable for multiple values it is advised to use a switch statement.
Same functions first one with if statements, second one with an switch statement.
The syntax is a bit different for switch statements. Instead of using {} for each case you end the case with break;
Break means it will stop going further into the switch statement and exit from that part of code. The default case is like the else for if statements and is advised to put in to check for errors.
The biggest advantage of using a switch statement for these cases is to get a better overview and manageability when checking for many cases.