compare using Boolean Operator

it it possible to use Boolean Operator to compare the variables of 3 Hc-Sr04 such as

if(Mdistance <= 20 && Ldistance <= 20 && Rdistance <=20)
{
moveStop();
delay(300);
moveBackward();
delay(400);
moveStop();
delay(300);
turnLeft();

will this slow down the operation?

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..

Williamsccz:
it it possible to use Boolean Operator to compare the variables of 3 Hc-Sr04 such as

if(Mdistance <= 20 && Ldistance <= 20 && Rdistance <=20)

{
moveStop();
delay(300);
moveBackward();
delay(400);
moveStop();
delay(300);
turnLeft();




will this slow down the operation?

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:

  if ((a & 0x33) == 0x22)

MarkT:
Why,

I like to do it what way.