How to update a function in loop?

void loop()
{
  frente();
  //Le as informacoes do sensor, em cm
  long microsec = ultrasonic.timing();
  range = ultrasonic.convert(microsec, Ultrasonic::CM) * 10.0;     //multiplies the range by 10 so the delay of the blinking is perceptible
  //Exibe informacoes no serial monitor
  Serial.print("\nDistancia em cm: ");
  Serial.print(range) / 10.0;    //should be printing the distance divided by 10, but it isn't
  delay(100);
  desliga();                    //turns off 
  delay(range);             // delay between turning on and off is determined by the range 
  liga();                       //turns on
}

So I came up with this reverse sensor. He blinks and beeps the buzzer with the delay between turning on and off determined by the range given by the ultrasonic sensor.
But I found a problem that while and if couldn’t solve. It will stop working once the sensor gives me a zero. I wanted it to check multiple times and turn off when range < 200 and = 0. How do I make a function that checks the condition indefinitely?

It doesn't have to be a function. You can have all the logic in the loop(). You have to get rid if the delay() statements and use millis() instead for timing these activities. See "Arduino blink without delay" as an example.

  Serial.print(range) / 10.0;    //should be printing the distance divided by 10, but it isn't

WRONG!

Probably should be

  Serial.println(range/10.0) ;

I cannot see the entire code so I do not know how the variable range was declared.