my code is not detecting if before else

i need help with my code because it is saying that there is no "if" before "else" please help here is the code if it helps.

define LED 12

define BUTTON 7

void setup() { { pinMode(LED, OUTPUT); pinMode(BUTTON, INPUT); }

void loop() if ( digitalRead(BUTTON)==HIGH) { digitalWrite(LED, LOW); } else { digitalWrite(LED, HIGH); } }

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/jayden/Desktop/program/program.ino: In function 'void setup()': program:11: error: expected initializer before 'if' if ( digitalRead(BUTTON)==HIGH) ^ program:15: error: 'else' without a previous 'if' else ^ exit status 1 expected initializer before 'if'

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

void loop() 
if ( digitalRead(BUTTON)==HIGH)
{
digitalWrite(LED, LOW);
}
else
{
digitalWrite(LED, HIGH);
}
}

You seem to have lost the opening { on the loop function. Always check your braces. If you press control-T the IDE will format the code and indent the blocks and make these sort of errors very easy to see. It also makes your code much more readable.

void setup() {
{
pinMode(LED, OUTPUT);
pinMode(BUTTON, INPUT);
}

Found the missing "{"

tinman13kup: void setup() { { pinMode(LED, OUTPUT); pinMode(BUTTON, INPUT); }

Found the missing "{"

Great. It's cheaper to reuse one than to have to buy a new one.

Loop needs one too.

Code tags, please.