leds blink/flasher

greetings to the masters;

sorry i’m a beginner, i have a problem with vocabulary in c ++ can you help simplify my coding
, here I want to make LEDs blink 2x for 2 times, and blink 3 times for 2 times.
and if value of analogValue > threshold(400) the process will stop without having to wait for everything to finish execution

thanks,
here my code:

///////////////////////////////////////////////////////////////////////////////////////////////

int potPin = A3; // select the input pin for the potentiometer
int timeFlash = 0; //
const int ledPin = 4;
const int analogPin = A1;
const int threshold = 200;

void setup() {
// initialize pin 4 (ATtiny leg 3) as an output.
Serial.begin(9600);
pinMode(4, OUTPUT);
pinMode(A3, INPUT);
pinMode(A1, INPUT);

}
void loop() {

timeFlash = analogRead(potPin);

int analogValue = analogRead(analogPin);
if (analogValue > threshold) {
digitalWrite(ledPin, LOW);
}
else {
for(int i=1; i<=2; i++){
digitalWrite(ledPin, HIGH);
delay(timeFlash);
digitalWrite(ledPin, LOW);
delay(timeFlash);
}
delay(200);
for(int i=1; i<=2; i++){
digitalWrite(ledPin, HIGH);
delay(timeFlash);
digitalWrite(ledPin, LOW);
delay(timeFlash);
}
delay(200);
for(int i=1; i<=3; i++){
digitalWrite(ledPin, HIGH);
delay(timeFlash);
digitalWrite(ledPin, LOW);
delay(timeFlash);
}
delay(200);
for(int i=1; i<=3; i++){
digitalWrite(ledPin, HIGH);
delay(timeFlash);
digitalWrite(ledPin, LOW);
delay(timeFlash);
}
delay(200);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////

since the code executes a sequence including delays, there's no way to test analog input

you need to use millis() to check if time has expired instead of using delay, allowing you to also test the analog input in each invocation of loop()

you can also parameterize the LED on and off times as well can maintaining a count to track a sequence where parameters may be modified at specific points in the sequence.

there are plenty of examples on this form.

@gcjr ,ok i will try to change that and i will post again ,