Multiple variables for an if statement

Does anyone know how to put more than one variable,(or number in my case of a serial monitor) into an if statement. I'm trying to have a between value like x<1000 but >800 in one if statement. Here's how my code is setup so it can be put into context.

void loop(){

  float lightLevel = readTSL230(TSL230_samples);
  Serial.println(lightLevel);

if(lightLevel<1000)
  {
    myservo1.attach(5);
    myservo1.writeMicroseconds(1300);delay(1000);  

}
if(lightLevel>4000)
{
  myservo1.attach(5);
  myservo1.writeMicroseconds(1700);delay(1000);
}

have a between value like x<1000 but >800

if(x > 800 && x < 1000)

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