Exit an instruction cycle as soon as the condition becomes false

Hello everyone, I'm new and I need clarification about the programming, perhaps maybe it is a trivial question ... but I can not figure out how.
I have the job of LEDs in a certain sequence when a pin is HIGH, and in a different sequence when it is LOW.
For example, in a program like this:

int pin;

void setup() {

pinMode(11,INPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);

}

void loop() {

pin=digitalRead(11);

if(pin==HIGH){
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
delay(50000);
}

else if(pin==LOW){
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
delay(50000);
}
}

If the pin is changed from HIGH to LOW or vice versa I have to wait for it to finish the previous cycle and does not change immediately as I would like ...
I can put something in place of 'IF it will solve my problem? or other solutions?
Thank you

You have to get rid of the delay. Check out the Blink without delay example

And the state change example