Calling functions in IF-ELSE

hi guys,i’m doing project for 2 ping sensors and one hc-sr04 to detect range and show the output with servo.
but now i’m having problem with calling functions into if-else. it shows error from declaration of the functions.

here’s my code

/* 
  Ultrasonic program with 2 ping sensor and one hc-sr04
  Output on servo motor Hitec HC-422
  */
  
 #define trigPinB 13
 #define echoPinB 12
 const int pingLeftB = 11;
 const int pingRightB = 10;
 int servo = 5;
 long low1, medium1, high1, low2, medium2, high2, low3, medium3, high3;
 long durbackleft, durbackright, durbackmid, disbackleft, disbackright, disbackmid;

 
 void setup()
 {
   pinMode (trigPinB, OUTPUT);
   pinMode (echoPinB, INPUT);
   pinMode (servo, OUTPUT);
 }
 
 void low1()
 {
   disbackleft = disbackleft < 3;
 }
 
 void medium1()
 {
   disbackleft = (disbackleft >= 3 && disbackleft < 10);
 }
 
 void high1()
 {  disbackleft = disbackleft >= 10;}
 
 void low2()
 {  disbackmid = disbackmid < 3;}
 
 void medium2()
 {  disbackmid = (disbackmid >= 3 && disbackmid < 10); }
 
 void high2()
 {  disbackmid = disbackmid >= 10;}
 
 void low3()
 {  disbackright = disbackright < 3; }
 
 void medium3()
 {  disbackright = (disbackright >= 3 && disbackright < 10); }
 
 void high3()
 {  disbackright = disbackright >= 10;}
 
 void loop()
 {
    
 // Back Left Sensor (Ping)
 
   pinMode(pingLeftB, OUTPUT);
   digitalWrite(pingLeftB, LOW);
   delayMicroseconds(2);
   digitalWrite(pingLeftB, HIGH);
   delayMicroseconds(5);
   digitalWrite(pingLeftB, LOW);
   pinMode(pingLeftB, INPUT);
   durbackleft = pulseIn(pingLeftB, HIGH);
   disbackleft = (durbackleft/2) /29.1;
   
 // Back Right Sensor (Ping)
 
   pinMode(pingRightB, OUTPUT);
   digitalWrite(pingRightB, LOW);
   delayMicroseconds(2);
   digitalWrite(pingRightB, HIGH);
   delayMicroseconds(5);
   digitalWrite(pingRightB, LOW);
   pinMode(pingRightB, INPUT);
   durbackright = pulseIn(pingRightB, HIGH);
   disbackright = (durbackright/2) /29.1;
 
 // Back Middle Sensor (HC-SR04)
 
   digitalWrite (trigPinB, HIGH);
   delayMicroseconds(100);
   digitalWrite (trigPinB, LOW);
   durbackmid = pulseIn(echoPinB, HIGH);
   disbackmid = (durbackmid/2) / 29.1;
   
   if(disbackleft = low1() && disbackmid = low2() && disbackright = high3())
   {
     digitalWrite (servo, HIGH);
     delayMicroseconds (1500);
     digitalWrite (servo, LOW);
     delay(20);
   }
   
   else if (disbackleft = medium1() && disbackmid = medium2() && disbackright = medium3())
   {
     digitalWrite (servo, HIGH);
     delayMicroseconds (1300);
     digitalWrite (servo, LOW);
     delay(20);
   }
   
   else
   {
     digitalWrite (servo, HIGH);
     delayMicroseconds (800);
     digitalWrite (servo, LOW);
     delay(20);
   }
   delay(10);
 }

the error i get is :

all_back_sensor_new:10: error: 'long int low1' redeclared as different kind of symbol
all_back_sensor_new:-1: error: previous declaration of 'void low1()'
all_back_sensor_new:10: error: 'long int medium1' redeclared as different kind of symbol
all_back_sensor_new:-1: error: previous declaration of 'void medium1()'
all_back_sensor_new:10: error: 'long int high1' redeclared as different kind of symbol
all_back_sensor_new:-1: error: previous declaration of 'void high1()'
all_back_sensor_new:10: error: 'long int low2' redeclared as different kind of symbol
all_back_sensor_new:0: error: previous declaration of 'void low2()'
all_back_sensor_new:10: error: 'long int medium2' redeclared as different kind of symbol
all_back_sensor_new:1: error: previous declaration of 'void medium2()'
all_back_sensor_new:10: error: 'long int high2' redeclared as different kind of symbol
all_back_sensor_new:2: error: previous declaration of 'void high2()'
all_back_sensor_new:10: error: 'long int low3' redeclared as different kind of symbol
all_back_sensor_new:3: error: previous declaration of 'void low3()'
all_back_sensor_new:10: error: 'long int medium3' redeclared as different kind of symbol
all_back_sensor_new:4: error: previous declaration of 'void medium3()'
all_back_sensor_new:10: error: 'long int high3' redeclared as different kind of symbol
all_back_sensor_new:5: error: previous declaration of 'void high3()'
all_back_sensor_new.cpp: In function 'void loop()':
all_back_sensor_new:87: error: void value not ignored as it ought to be
all_back_sensor_new:87: error: void value not ignored as it ought to be
all_back_sensor_new:95: error: void value not ignored as it ought to be
all_back_sensor_new:95: error: void value not ignored as it ought to be

as u can see,i’m implementing low1() until high3() functions into if else functions but i dont know if my method was correct or not…can someone help me?

thank you so much for yout help…

You cant have variables and functions with the same names.

long low1,
 void low1()
long low1, medium1, high1, low2, medium2, high2, low3, medium3, high3;

...

void low1()
 {
   disbackleft = disbackleft < 3;
 }

As the compiler said, first you declare low1 as a long, then as a function. Make up your mind what you want “low1” to be.

 if(disbackleft = low1() ...

This is not correct. This is assigning, not comparing. I suggest you Google a C tutorial.

dxw00d:
You cant have variables and functions with the same names.

long low1,
 void low1()

thanks,already delete the declaration…now the problem is to call any equations into if else…

thank u…basically i want replace equation (example:x<a && x>b) with a word (such as ‘low’)…any idea to do that?

Which C tutorial did you read? Just so I know.

thanks,already delete the declaration..now the problem is to call any equations into if else..

You can, but not assigning the void return code to a variable. That won't work. You must make your function return type bool, and then you can just call it:

if(low1())
{
   // low1() returned true