Using PanasonicIRSensor code to manipulate servos

Hello, I am in the midst of a project to try and create a bot that is controlled by the ir sensor. I want the ir sensor to dictate whether the bot simply runs forward, or if it stops, turns, and tries forward again. How would I be able to do that? I have tried with a simple if else statement in the void loop, but it does not seem to work. Let me know any advice you guys have as I am very very new. Thank you!

#define irLedPin 13 // IR Led on this pin
#define irSensorPin 8 // IR sensor on this pin
#include <Servo.h>

Servo servoLeft;

int irRead(int readPin, int triggerPin); //function prototype

void setup()
{
servoLeft.attach(2);
pinMode(irSensorPin, INPUT);
pinMode(irLedPin, OUTPUT);
Serial.begin(9600);
// prints title with ending line break
Serial.println(“Program Starting”);
// wait for the long string to be sent
delay(100);

}

void loop()
{
Serial.println(irRead(irSensorPin, irLedPin)); //display the results
delay(10); //wait for the string to be sent
int value = ; //don’t really know which variable to use, as none seem to work

if ( value = 1)
{
servoLeft.write(0);
}
else
{
servoLeft.write(180);
}

}
int irRead(int readPin, int triggerPin)
{
int halfPeriod = 13; //one period at 38.5khZ is aproximately 26 microseconds
int cycles = 38; //26 microseconds * 38 is more or less 1 millisecond
int i;
for (i=0; i <=cycles; i++)
{
digitalWrite(triggerPin, HIGH);
delayMicroseconds(halfPeriod);
digitalWrite(triggerPin, LOW);
delayMicroseconds(halfPeriod - 1); // - 1 to make up for digitaWrite overhead
}
return digitalRead(readPin);

}

  Serial.println(irRead(irSensorPin, irLedPin)); //display the results

But, god forbid that you actually understand what these functions are doing. Why not store the output from the irRead() function into a variable, and print, and use, that variable?

#define irLedPin 13          // IR Led on this pin
#define irSensorPin 8       // IR sensor on this pin
#include <Servo.h>

Servo servoLeft;

int irRead(int readPin, int triggerPin); //function prototype

void setup()
{
  servoLeft.attach(2);
  pinMode(irSensorPin, INPUT);
  pinMode(irLedPin, OUTPUT);
  Serial.begin(9600); 
  // prints title with ending line break 
  Serial.println("Program Starting"); 
  // wait for the long string to be sent 
  delay(100); 
  
}

void loop()
{  
  delay(10); //wait for the string to be sent
  int value =irRead(irSensorPin, irLedPin) ; 

  if ( value == HIGH)
  {
    servoLeft.write(0);
  }
  else
  {
    servoLeft.write(180);
  }
 Serial.println(value); //display the results
 digitalWrite(irLedPin, LOW);
delay(200);
}
int irRead(int readPin, int triggerPin)
{
 
    digitalWrite(triggerPin, HIGH); 
    return (digitalRead(readPin));


}