Exiting a loop with serial command

Hello. im not sure whether im doing what i want in a right way or not.
there is a situation ive encountered. im trying to couple an LED with my board. i want the LED to turn on and start blinking when i send “a” into serial using my pc, and stop blinking and turn off when i send “b”
ive written a code but i dont know how to exit loops using serial. my code has a problem and its that it makes the board wait for serial input and doesnt do anything else (like executing the for loop for making LED blink). i dont know if i should use interrupts neither do i know exactly how to use them in this situation. id be thankful from you all if you help me with this matter.

it would help if you posted you're code

presumably code in loop() checks whether you want the LED to blink and "if" so, uses millis() (not delay()) to check when a time interval has elapsed to change the state of the LED.

loop() should check whether it needs to do something and do, then exit.

you can also check if something is available from the Serial interface using Serial.available() and "if" so, read it and perform some action based on what you read.