Need help on how to write code on this.. Newbie..

A slide switch is read once every 4 seconds. If it is on the right, the LED will blink 2 times in 2 seconds and become off for the remaining 2 seconds. If it is on the left, the LED will be on for 2 seconds and become off for the remaining 2 seconds.

This is a forum for help, not sketches. So what have YOU tried so far?

Start small.

Do you know how to turn an LED on ?
Do you know how to read the state of an input pin (HIGH or LOW) ?
Do you know how to take different actions based on the state of an input pin ?

Have you looked at the examples in the IDE ?

void loop() {
    if (digitalRead(SlideSwitchPin)) {
          // blink 2 times in 2 seconds 
          digitalWrite(LEDPin, HIGH);
          delay(666);
          digitalWrite(LEDPin, LOW);
          delay(667);
          digitalWrite(LEDPin, HIGH);
          delay(666);
     } else {
          // be on for 2 seconds

          digitalWrite(LEDPin, HIGH);
          delay(2000);
    }
    // become off for the remaining 2 seconds.
    digitalWrite(LEDPin, LOW);
    delay(2000);

}

Why does it have to read the switch once every 4 seconds? I would have it read the switch 10,000 times per second. That way it can react instantly to any change.

const int SlideSwitchPin = 2;
const int SwitchIsLeft = LOW;
const int LEDPin = 13;
const int LEDon = HIGH;
const int LEDoff = LOW;
void setup() {
  pinMode(LEDPin, OUTPUT);
  pinMode(SlideSwitchPin, INPUT_PULLUP);
}

void loop() {
  //the timing always takes 4 seconds
  //if the switch is right...
  //  second 1 - LED flashes on-off
  //  second 2 - LED flashes on-off
  //  second 3 - LED off
  //  second 4 - LED off
  //if the switch is left...
  //  second 1 - LED on
  //  second 2 - LED on
  //  second 3 - LED off
  //  second 4 - LED off


  int SwitchState = digitalRead(SlideSwitchPin);

  //since we need on-off inside 1 second, divide the 4 seconds into 8 equal units
  
  //Get the milliseconds, divide by 500 for halfseconds
  //then get the remainder from dividing by 8 (0, 1, 2, 3...7)
  switch((millis()/500)%8) {
    case 0:
      digitalWrite(LEDPin, LEDon);
    break;
    case 1:
      if(SwitchState == SwitchIsLeft) {
        digitalWrite(LEDPin, LEDon);
      } else {
        digitalWrite(LEDPin, LEDoff);
      }
    break;    
    case 2:
      digitalWrite(LEDPin, LEDon);
    break;
    case 3:
      if(SwitchState == SwitchIsLeft) {
        digitalWrite(LEDPin, LEDon);
      } else {
        digitalWrite(LEDPin, LEDoff);
      }
    break;    
    case 4:
    case 5:
    case 6:
    case 7:
      digitalWrite(LEDPin, LEDoff);
    break;
  }

}

Sounds like a classroom assignment.

Of course it is. Shut up and do your homework!