Code Inspection: Invert 'if' statement to reduce nesting
Last modified: 21 July 2022tip
Consider the following code snippet:
As you can see, the if
blocks encompass the whole body of the method. This presents an opportunity to make code more readable by getting rid of the nested scope as follows: