What should you do when the need to check many conditions results in deeply nested code?
Avoid nesting more than three levels when using conditional and looping constructs. A great resource on refactoring techniques for minimizing nesting is here.
Avoid deeply nested code because it’s difficult to understand and debug. Use static analysis tools to determine the cyclomatic complexity of your code.