Breaking a while loop

as it freezes/blocks your code from doing other things
As general "making small talk to get points, OK.

Not applicable in this case - the only "thing" the code does is to monitor temperature and controls the fan. KISS

Hera are some different ways to accomplish the task. Suggesting to add another while loop to keep the motor off for selected time and still keep checking the temp.

IN PSEUDOCODE not to be cut and paste !

int sensor = A0; //temp sensor on pin A0
int temp = 0; //do not change
int relay = 5; //relay is on pin 5

void setup() {
pinMode(sensor, INPUT); //set sensor as input
pinMode(relay, OUTPUT); //set relay as output
}

void loop()
{
// temp = analogRead(sensor); //read the value from the sensor
if (analogRead(sensor) >= 80) // If temp is 80 or above
{
temperature while loop
while (analogRead(sensor) > 70) { // and Until temp is below 70
digitalWrite(relay, HIGH ); // turn relay on

}
turn the relay off

get start time to keep relay off

relay off wait loop
while (current time - start time < motor off time & (analogRead(sensor) < ? temp ? ))
; keep motor off and keep checking temp

}

digitalWrite(relay, LOW); //Turn relay off and restart loop
}

Can't do code tags when copying code.