Don't write complicated expressions inside ofif statements (just after theif); instead, store the expression's result in a Boolean variable with a quality, descriptive name and use that variable in theifstatement.

That will make the logic being implemented extremely easy to understand!

As you see, the bad code tells us only WHEN the condition is true, but the good code tells us both WHEN and WHY!!! It is so important that I easily go against the rule to decrease scripts size - I don't try to keep my scripts short in any price, sometimes I prefer to ADD LINES if that makes the code more understandable or less looking like a heap of rubbish. And, of course, don't forget that the expression in my example is pretty small because it's enough to convey the idea; in the real life I have seen statements with half-a-screen Boolean expressions inside an if! If the logic is complicated then don't populate the Boolean variable in one assignment statement (as described above) but come to the truth step by step, using a number of simple Boolean expressions instead of one monstrous construction. Please see the next example of populating a variable step by step instead of inserting everything in the if statement: