Multiple variables for an if statement

and if not sure of the precedence of the operators you can always use extra ()

if ( (x > 800) && (x < 1000) )
{

Technically this is equal to

if ( x > 800) 
{
  if ( x < 1000)
  {
    ....
  }
}

The compiler creates short circuit evaluation of compound if statements.
This means that with a statement in the form

  • IF (A && B) the expression B is not evaluated if A is false.
  • IF (A || B) the expression B is not evaluated if A is true