Nested switch statements
Occasionally, I find myself looking at code with nested switch statements, which need to be modified. For example, the following nested switch statements in MATLAB look at different particle types and charges: A nice way to refactor this is to combine the cases of the nested switch statements: This makes the code cleaner and easier…