the function call just partly work

It would be best to parenthesize the two separate conditions

And, as Pete showed, some judicious use of white space makes the code so much easier to read.