BEGINNER QUESTION--toggle between 2 LED PATTERNS

Hi

Pls help me with this, i've looked around but no luck

i want to use the serial monitor to change between 2 different 03 led patterns

Pattern 'a' will light all the leds at the same time

Pattern 'b' will light the first led, then the next one (first one gets off), then the third (the second one off) then keep it looping.

problem is that i cant get 'b' looping. Also i cant go back to 'a'.

many thanks in advance!!

code is:

int led1 = 2;
int led2=3;
int led3=4;
char leer;

void setup() {

Serial.begin(9600);
pinMode (led1,OUTPUT);
pinMode (led2,OUTPUT);
pinMode (led3, OUTPUT);
}

void loop() {
leer=Serial.read();
if(leer=='a')
{
digitalWrite(led1,HIGH);

digitalWrite(led2,HIGH);

digitalWrite(led3,HIGH);

}
if(leer=='b')
{
for(int x=2;x<5;x++)
{
digitalWrite(x,HIGH);
delay(1000);
digitalWrite(x,LOW);
}

}

}

You are reading before checking if there is anything to read.

void loop() {
if (Serial.available() > 0){
  // yes, something came in, now you can read it
  leer=Serial.read();

Thank you!! that solved the problem.