JetBrains Rider
 
2024.3
Get JetBrains Rider

Code inspection: Invert 'if' statement to reduce nesting

Last modified: 11 February 2024

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: