Interrupts behavior

if I write a code that includes interrupts. Also, the main loop depends mainly on an if and if else statement. After the interrupt is triggered and finalized, the program would run back normally. My question is, when it goes back to the main loop, would it check the main if statement or it will pick up from where it stopped regardless of the if statement?

for example:

void setup()
{

attachInterrupt(digitalPinToInterrupt(2),BUCK,RISING);

}

void loop()
{
if (Flag == 1){

i= 1;
Flag = 0;}

if (Flag == 0){

z= 1;}

}

void BUCK()
{
digitalWrite(Switch, LOW);
delayMicroseconds(200);
Flag = 1;
}

would it check for the condition of Flag after getting back from the interrupt first, or it will pick from where it stopped?

Interrupts know nothing of your "code". Returns to the next machine instruction after the interrupt.

Paul

I guess you didn't get the memo about interrupt service routines should be as short as possible.

Another newbie not comprehending what interrupts are for. :roll_eyes:

Forget about interrupts! Tell us what you actually want to do.