need help with logics

Take a look at logical operator precedence and then decide if you are using the parentheses correctly.

Hint: since you are treating X and Y differently, for the same basic logical test, the answer is no.