Why does the IDE indicate that a code in the "if" will not be executed?

0

Look at the code:

Why is the development IDE not considering the code in line 34, 35 and 36?

Would not it have been to go into the conditional?

    
asked by anonymous 14.10.2018 / 13:32

1 answer

8

IDEs just show this to you, probably it is not what you're thinking . The compiler is who understands the code and generates something that will be executed or not. In this case there is nothing wrong with the code. What IDEs do is guide you when you see something that is weird and should not be there. It is the case of these three lines that do not have to exist. Since 5 is never greater than 6 the condition will always be false and the contents of if will never be executed, so all three lines are innocuous and should be removed from the code. Even if it were always true then if could be eliminated, leaving only the direct increment without conditional.

So in this case it will never go into the conditional when it is executed, it is a clear false condition and the IDE has already informed you that you will not waste time with this code

    
14.10.2018 / 13:36