programming of 4wd robot using ping sensor

  if (distance >= 20) {
    distance = ping();
    turnRight(); // function that turns the robot right
  }

If distance is greater than or equal to 20, overwrite it, and then call turnRight(). Why overwrite it?