Programming quesion \\

Hi all,
i have a question regarding my code.

#include <Wire.h> //BH1750 IIC Mode 
#include <math.h> 
int BH1750address = 0x23; //setting i2c address
byte buff[2];
void setup()
{
  Wire.begin();
  Serial.begin(115200);//init Serail band rate
  pinMode(2, OUTPUT);     
  
  
}
 
void loop()
{
  int i;
  uint16_t val=0;
  BH1750_Init(BH1750address);
  delay(200);
 
  if(2==BH1750_Read(BH1750address))
  {
    val=((buff[0]<<8)|buff[1])/1.2;
    Serial.print(val,DEC);

//IF
[b]if (val < 70 && val >50)[/b]

{
  delay(1000);

  digitalWrite(2,HIGH);
  delay(100);
      Serial.print("ON!");

  
}  //END 
else {
  
    digitalWrite(2,LOW);
    Serial.print("NF!");


}//END ELSE
Serial.println("[lx]"); 
  }
  delay(150);
}
int BH1750_Read(int address) //
{
  int i=0;
  Wire.beginTransmission(address);
  Wire.requestFrom(address, 2);
  while(Wire.available()) //
  {
    buff[i] = Wire.read();  // receive one byte
    i++;
  }
  Wire.endTransmission();  
  return i;
} 
void BH1750_Init(int address) 
{
  Wire.beginTransmission(address);
  Wire.write(0x10);//1lx reolution 120ms
  Wire.endTransmission();
}

i want from the if loop once a value is detected to end the loop and recheck new value
how can i do that ?

click the MODIFY button in the upper right of the post window.
Highlight all you code.
click the "#" CODE TAGS button on the toolbar above just to the left of the QUOTE button.
click SAVE (at the bottom).
When you post code on the forum, please make a habit of using the code tags "#" button.

its done thanks

i want from the if loop once a value is detected to end the loop

That's what return does. Add a return statement to the if block.

On the other hand, look at what code the return statement will skip, and ask yourself why you need to skip that. It would probably be a lot easier to see the answers if you properly indented your code (and used appropriate amounts of white space). The Tools + Auto Format menu will make the first part easy.