hello Arduino community

Hi every one i have quick question
I applied my code to the program it gives me error

exit status 1
‘else’ without a previous ‘if’

in the beginning it was working then start to give me this error

here is the code

#include <Servo.h>
Servo myservo;

int red = 2;
int green = 3;
int pushPin = 10;
int blue = 8;
int val = 1;
int pos = 0;
int buzzer = 11;

void setup() {
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
pinMode(blue, OUTPUT);
Serial.begin (9600);
myservo.attach(9);
pinMode(buzzer, OUTPUT);

}

void loop(){
val = digitalRead(pushPin);{
if(val == HIGH);
{
digitalWrite(green, HIGH);
digitalWrite(red, LOW);
delay(1);
digitalWrite(blue, HIGH);
delay(70);
digitalWrite(blue, LOW);
delay(70);
tone(buzzer, 100);
delay(1);

for (pos = 180; pos <= 0; pos -= 1);
myservo.write(pos);
delay(1);
}
}
else {
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
noTone(buzzer);
delay(1);
for (pos = 0; pos <= 90; pos += 1); {
myservo.write(pos);
delay(1);
}
}

exit status 1
‘else’ without a previous ‘if’

if(val == HIGH);

See anything wrong here?

I suggest you get anal about indenting an it will make it a great deal easier for you to spot such compile error.
So…

void loop()
{
    val = digitalRead(pushPin);
    {
         if(val == HIGH);
         {         
              digitalWrite(green, HIGH);
              digitalWrite(red, LOW);
              delay(1);
              digitalWrite(blue, HIGH);
              delay(70);
              digitalWrite(blue, LOW);
              delay(70);
              tone(buzzer, 100);
              delay(1);

              for (pos = 180; pos <= 0; pos -= 1);
              myservo.write(pos);             
              delay(1);
         }
    }
    else 
    {
        digitalWrite(red, HIGH);
        digitalWrite(green, LOW);
        noTone(buzzer); 
        delay(1);
        for (pos = 0; pos <= 90; pos += 1); 
        {
            myservo.write(pos);             
            delay(1);
        }
    }

You can see that you are missing a closing brace corresponding to the opening brace under the line void loop()

If you remove the opening brace under the line val = digitalRead(pushPin); and then re-adjust all the indenting then the opening and closing braces {} will all match up.

Also the line if(val == HIGH); is an empty if statement, i.e. if the condition is true then there is no specific code to execute. All the code between the {} is executed regardless of whether the condition is true.

If you change that line to if(val == HIGH), i.e. remove the semi-colon, then all the code between the braces {} becomes part of the if statement and is executed only if the condition is true.

And you have done the same thing with this line of code: for (pos = 0; pos <= 90; pos += 1);
This is an empty for loop - remove the semi colon.

Do a ctrl-T and it will format nicely with indents as suggested.

And as a btdubs, if in the IDE you park the cursor over a brace or bracket, it will highlight its mate with a little box.