If condition

I am making a robot where i have to check a condition.

The condition is if x< (-5) or x > 5 i want to execute a command.
How do program this.
Please reply fast.

Thanks in advance.

if(abs(x) > 5){
  //do stuff
}

Using abs() is the smart way, but if you want it to be more like your original conditions when you read it later

if (x < -5 || x > 5)  //|| is the logical or function in C
  {
    //code to run when in range goes here
  }

As you are using C++ on the Arduino this will work too

if (x < -5 or x > 5)
  {
    //code to run when in range goes here
  }

The condition is if x< (-5) or x > 5 i want to execute a command.
How do program this.

Just like that, but with parentheses in the proper place.

if(x < -5 or x > 5)
{
   executeCommand();
}