Problem with my PING code?

void loop() 
{
  forward ();
  while (ping () > 5);
  haltMotors();   //stop the motors before reversing direction
  delay(3000);
  backward (); 
  while (ping () < 10) ;  //move robot back 10 inches before turning
  turnRight();
}