Blink LED without delay while running a function

Someone a idea how to run LED in the same time a function is called in the loop?

#include <Servo.h>
#define SDM_IO_TIMEOUT 1000

int IRsensorpin=0;
int servopin = 51;
int sensorpin = 0;                 // analog pin used to connect the sharp sensor
int dist = 0;                 // variable to store the values from sensor(initially zero)

const int ledYeright = 24;
const int ledYeleft = 40;
const int ledredright = 30;
const int ledredleft = 36;

int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;
long interval = 500;
boolean running_warningBlink;

int leftdist;
int rightdist;
int groundcontrol;

Servo myservo;

int pos = 0; 

// constants won't change. Used here to
// set pin numbers:

void setup() {
  // set the digital pin as output:
  pinMode(ledYeleft, OUTPUT);
  pinMode(ledredright, OUTPUT);
  pinMode(ledredleft, OUTPUT);

void loop()


void warning_led()
// here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;  

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledYeright, ledState);
    digitalWrite(ledYeleft, ledState);
    digitalWrite(ledredright, ledState);
    digitalWrite(ledredleft, ledState);

void look() {
  //void look(int &rightlook, int &leftlook) {
  //look left
  for(pos = 90; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(30);                      // waits 40ms for the servo to reach the position   

 // leftdist=getDistance_sensor();


  //look right
  for(pos=180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(30);                     // waits 40ms for the servo to reach the position 

 // rightdist=getDistance_sensor();


  //look forward
  for(pos = 1; pos < 90; pos +=1)

The code you posted does something. You didn't explain what.
You wanted the code to do something. You didn't explain what.

What's with all the delay()s?

Sorry you are right.
When the look() function calls the warning_led() the led s turns on and the look() function goes ahead.

I want that the leds blink while the look() function is running. And when the look() function is over the LED turn off.
The LED blink function is already without delay. And when i test it seperatly it works.

The one delay of 5 seconds is for testing.

The other delays in the look() are for the servo, he needs time to go in his new position.