Nested if or switch case statement
问题 From the point of view of optimizing the code run time, is there a thumb rule for where to use "nested if" statement and when to use "switch case" statements ? 回答1: I doubt you will ever find a real-life application where the difference between a nested if and a switch case is even worth measuring. Disk access, web access, etc. take many many orders of magnitude more time. Choose what is easiest to read and debug. Also see What is the difference between IF-ELSE and SWITCH? (possible duplicate