My LED doesnt turn off

Hello, this is my first post here, so if I am doing anything wrong, please let me know so I can improve.
I am also fairly new to Arduino so I don’t know much, Im trying to get better creating some projects and reading online.

I have a problem, my LED doesn’t turn off, it should only turn on if the condition matches and it does that perfectly, but after its on for the first time, it wont turn off, even if the condition does not match.

I am using:

Below is my code:

#include "DHT.h"

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //pins from  lcd

#define DHTPIN 11     // pin from sensor

#define DHTTYPE DHT22   // DHT 22

int led = 12;  // pin from led


DHT dht(DHTPIN, DHTTYPE);

void setup() {
  pinMode(led, OUTPUT);
  lcd.begin(16, 2); 
  dht.begin();
}

void loop() {
  // waits 2 seconds 
  delay(2000);

  int h = dht.readHumidity();  // reads humidity
  
  int t = dht.readTemperature(); // reads temperature
  
  if ( t > 22 ) 
  {
    digitalWrite(led, HIGH); 
  }
 
 
  lcd.setCursor(0,0); 
  lcd.print("H:"); 
  lcd.print(h);
  lcd.print("%");
  lcd.setCursor(10,0); 
  lcd.print("T:"); 
  lcd.print(t);
  lcd.print("*C");
 
}

Thanks for reading.

There is no code to turn off the led, only to turn on. I'd look at that.

Exactly! I was not thinking that way, I thought that after it looped again it would reset the LED and turn it off, but it won’t.

Added that line and now its working

Code:

#include "DHT.h"

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //pins from lcd

#define DHTPIN 11     // pin from sensor

#define DHTTYPE DHT22   // DHT 22

int led = 12;  // pin from led

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  pinMode(led, OUTPUT);
  lcd.begin(16, 2); 
  dht.begin();
}

void loop() {
  // waits 2 seconds
  delay(2000);

  int h = dht.readHumidity();  // reads humidity
  
  int t = dht.readTemperature(); // reads temeprature
  
  if ( t > 21) 
  {
    digitalWrite(led, HIGH); 
  } 
    else
  {  
    digitalWrite(led, LOW);
  }
 
 
  lcd.setCursor(0,0); 
  lcd.print("H:"); 
  lcd.print(h);
  lcd.print("%");
  lcd.setCursor(10,0); 
  lcd.print("T:"); 
  lcd.print(t);
  lcd.print("*C");
 
}

Thanks a lot buddy!