Multiple OR in IF statement

I'm reading from a LDR and sending it to the Serial motinor. Here is the code:

int val = 0;       // variable to store the value coming from the sensor
int OldVal=0;
void setup() {
  pinMode(LDR, INPUT);       // declare the LDR as an INPUT

void loop() {
  val = analogRead(LDR);       // read the value from the sensor
  if ((val != OldVal) || (val != OldVal+1) ||( val != OldVal-1)) {  
    Serial.print("  Val=");    

Why the multiple OR (||) here doesnt work? This code is sending:

OldVal=1006  Val=1006
OldVal=1006  Val=1007
OldVal=1007  Val=1007

What is wrong with my code or there are some limitations in the language? Thanks!

There is nothing wrong with that code, nor the results you posted. Maybe you want to use AND && ?

What are you trying to accomplish?

If val is 500 i want to avoid IF if OldVal is 499 || 500 || 501

What exactly are you trying to do? Because all three sets of values do satisfy the triple or.

1006 != 1006 plus or minus 1 1006 != 1007 and 1006 != 1007 +1 1007 != 1007 plus or minus 1

Are you trying to only send values if the reading changes by more than 1? If so, then use && instead of ||.

Whoops! Alphabeta beat me.

Okay, so I read your post, and you said that

If val is 500 i want to avoid IF if OldVal is 499 || 500 || 501

. Then why are you using !=?

Oops shame on me :-/ my logic suck.
Thanks guys it works with &&

No problem, everyone makes simple mistakes like that.