How to run a function for a specific interval, i.e. 10s?

I am working on code to ON the LED for 10 seconds after certain condition (x=false), but the code below runs infinitely. How should correct it? Thanks. I don't want to use delay() function as it stop the other functions running inside the loop.

void loop()
{
if(x=false){
TimerLighting = millis();
if(millis()-TimerLighting <=10000){
digitalWrite(LED,HIGH);
}
else{
digitalWrite(LED,LOW);
}
}
}

You're almost there,
Check the famous - blink without delay - example and you know the details (tutorial section)

 if(x=false){

Why are you assigning false to x? = is an assignment operator. == is the equality operator.

Jack9938:
I am working on code to ON the LED for 10 seconds after certain condition (x=false), but the code below runs infinitely. How should correct it? Thanks. I don't want to use delay() function as it stop the other functions running inside the loop.

void loop()

{
  if(x=false){
    TimerLighting = millis();
    if(millis()-TimerLighting <=10000){
      digitalWrite(LED,HIGH); 
      }
    else{
      digitalWrite(LED,LOW);   
    }
  }
}

You're setting TimerLighting = millis() each time through loop() and then immediately checking if(millis()-TimerLighting <=10000). This will always be true! Just as looking at a clock every 5 minutes to see if an hour has passed since you last looked at the clock will always be false. TimerLighting = millis(); should be in setup() so that it only gets set once.