Why is this an issue?
if statements with conditions that are always false have the effect of making blocks of code non-functional.
statements with conditions that are always true are completely redundant, and make the code less readable.
There are three possible causes for the presence of such code:
- An if statement was changed during debugging and that debug code has been committed.
- Some value was left unset.
- Some logic is not doing what the programmer thought it did.
In any of these cases, unconditional
if statements should be removed.
Noncompliant code example