The if() statement is fast. You should be more worried about those delays.
The processor does nothing (and not reading any sensors) during those delays.
Get rid of them, and manage timings with millis().
There is a "BlinkWithoutDelay" example in the IDE.
Leo..
Yes, it is possible. Yes delays slow down things.
I think is is a good idea to get into the habit of using the '(' and the ')' to create groupings in the if statement like so if( (Mdistance <= 20) && (Ldistance <= 20) && (Rdistance <=20) )
Idahowalker:
I think is is a good idea to get into the habit of using the '(' and the ')' to create groupings in the if statement like so if( (Mdistance <= 20) && (Ldistance <= 20) && (Rdistance <=20) )
Why, its more cluttered, boolean operators bind loosely specifically so you can write these statements without lots of superfluous parentheses. Parentheses are for when the operator binding doesn't do what you want, as in the bit operators: