switch problems

im try to make an led to turn on when the switch is pressed for 1 time and then turn off and when thbe switch is pressed again another led is switched offf can someone tell me what is wrong in my above code to perform this.

const int buttonPin = 2; 
const int led = 7;
const int led1 = 8;

int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(led, OUTPUT);
  pinMode(led, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
 
  digitalWrite(led, LOW);
   digitalWrite(led1, LOW);
  buttonState = digitalRead(buttonPin);
   int buttonState1 = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  
  if (buttonState == HIGH) {     
    // turn LED on:    
   
    digitalWrite(led, HIGH);  
    delay(5000);

  } 
  buttonState == LOW;
if(buttonState1 == HIGH){
   digitalWrite(led1, HIGH);  
    delay(5000);
}
  
}

Moderator edit: CODE TAGS

buttonState == LOW;

Did you mean "="?

i arrange that however always the same led is going on is there a piece of code that disable the previous action

You need to make led1 an output.

const int led = 7;
const int led1 = 8;

Do you count things like "1, 2, 3...", or do you count things like "Yes, I have a thing, 2, 3..."?

  pinMode(led, OUTPUT);
  pinMode(led, OUTPUT);

Maybe you need three or four calls to pinMode that do exactly the same thing.

  buttonState = digitalRead(buttonPin);
   int buttonState1 = digitalRead(buttonPin);

Unless you are faster than lightening, these two variables will contain the same value.

  buttonState == LOW;

This is performing a useless test.

im try to make an led to turn on when the switch is pressed for 1 time and then turn off and when thbe switch is pressed again another led is switched offf can someone tell me what is wrong in my above code to perform this.

Aside from those things, you have several basic problems. For one, you only want to do something when the switch state changes, to pressed. You are not testing for a state change.

Second, you are not counting presses, so you have no idea how many times, on any given pass through loop(), the switch has been pressed.

Finally, hasn't anyone ever told you to "Turn the damned lights off when you are done!"?

how can i make the switch output as it was in the beginning as it is pressed one time

how can i make the switch output as it was in the beginning as it is pressed one time

You can't affect the output of a function. You can modify the value in a variable, but you really should treat the output from digitalRead() as though it is read only.