Error ;'else' without a previous 'if'

when I try to compline thios code:
buttonStateR = digitalRead(buttonR);

if (buttonStateR == HIGH);{

    buttonState4 = digitalRead(button4);
    
       while (buttonState4 ==HIGH){
        
        tone(buzzer,450);
        delay(1000);
        noTone(buzzer);
        delay(1000) ;
       }            
            digitalWrite(led_red, HIGH);
            delay(500);
            digitalWrite(led_red, LOW);
            delay(500);
          
            digitalWrite(led_ylw, HIGH);
            delay(500);
            digitalWrite(led_ylw, LOW);
            delay(500);
          
            digitalWrite(led_grn, HIGH);
            delay(500);
            digitalWrite(led_grn, LOW);
            delay(500);
            
              tone(buzzer, 450);
              delay(500);
              noTone(buzzer);
              delay(500);
            
              tone(buzzer, 450);
              delay(500);
              noTone(buzzer);
              delay(500) ;
           
              tone(buzzer,450);
              delay(500);
              noTone(buzzer);
              delay(500) ;

}
else {
state = 0;
}

I always get the Error:
'else' without a previous 'if'

why is this?

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

You shouldn't have the semicolon there.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.