Infared sensor

Hi,
Does anyone know a simple code that will print out an Infared sensors value to the serial monitor? Also is there a way to put that value into an "if" statement where (say the value is 100) it will do what is in the "if" statement eve if it is for example +- 5. I know you can say " <100" but is there a way to do " 95<x<105". Thanks.

Serial.println(value);

if ((95 < x) && (x < 105))
{  /* Do something */
}