Problems of programming

i'm try to make a quiz for my project however im encountering a problem when the user have to chose the answer as the previous output is being outputted. the above is my code

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):

// print the number of seconds since reset:
buttonState = digitalRead(buttonPin);
lcd.setCursor(1, 7);
for(i=0;i<1;i++){
if (buttonState == HIGH) {
// turn LED on:

lcd.print("SPORTS WAS CHOSEN");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
buttonState == LOW;
}
}
lcd.print("Which team won ");
lcd.setCursor(0, 1);
lcd.print("the World cup?");
lcd.setCursor(0, 2);
lcd.print(" a. A");
lcd.setCursor(0, 3);
lcd.print(" B. B");
buttonState = digitalRead(buttonPin);
if(buttonState == HIGH){

lcd.print(" Wrong answer ");
digitalWrite(led, HIGH);
delay(1000);
}
}

Try a single = here:

lcd.print("SPORTS WAS CHOSEN");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
buttonState == LOW; <<<
}

first of all thanks for your help :slight_smile:

i try that but the problem is that when i'm pushing the swicth again the bulb is going on and also the text "sport was chosen"

okay, you are probably seeing "button bounce"

Go check the Learning section for "debounce" so the button is only read once when pressed.

  for(i=0;i<1;i++){

Please explain that.

it basically loops for 1 time i did to experiment. however it does noting