compile error (SOLVED)

hi, im trying to make my arduino blink 3 times when i press the first button and blink 5 times when i press the other button. I started with making the code for the first button. But it gives me an error code when i try to verifiy it. it says: exit status 1. expected initializer before 'buttonstate'
i dont get this error what should i add to get rid of the error?

code:

int Ledpin = 13;
int buttonpin = 2;
int buttonPin = 3;

void setup() {
pinMode(Ledpin, OUTPUT);
pinMode(buttonpin, INPUT);
pinMode(buttonPin, INPUT);
}

void knipper3x(){
digitalWrite(Ledpin, HIGH);
delay(1000);
digitalWrite(Ledpin, LOW);
delay(1000);
{

void loop()

buttonstate = digitalRead(buttonpin);
if(buttonstate == HIGH){
knipper3x();
knipper3x();
knipper3x();
}

}

You can't use a variable like buttonstate without ever defining it. You either need to define it at the top with the other variable or at least preface it with the type (e.g. bool, byte, int etc) when you first use it.

Steve

I think you're missing the first { in loop too.

...and don't create two variables (which should be constants) distinguished only by case.
It's a recipe for disaster.

Looks like your first mistake is trying to end knipper3x() with '{' instead of the proper '}'.

Then you forgot the '{' after 'void loop()'.

Then you use 'buttonstate' without declaring it. Adding 'int' in front of it will declare it.

Fix those three things and it verifies.

thank you guys for the help it works now. I realised that my code was very messy. missed alot of brackets. found out the use of CTRL + T. now i want to close this topic but where do i do that (ง •̀_•́)ง