Nesting if with AND OR

I am working on an application where multiple sensor values need to be evaluated. Normally I would use:

if ( (acx < 100) && (acy > 100) ) { do things; }
Now I need to do things when acx value is either below 50 or above 150, can I nest this the following way?

if ( ((acx < 50)||(acx > 150)) && (acy > 100) ) { do other things; }
Or are there better ways to do this?

Hello.

Yes, you can nest your conditions like that in a single IF statement.

- Amanda

Thank you, this cleaned up my IF, AND and OR statements, it works