expected unqualified-id before 'if'

Hello, ive got this error message, "expected unqualified-id before 'if'". the code worked before but ive started adding the millis function in and now I get this.

(Will almost certainly be back to ask about the millis later!! trying to get a delay once the SwitchSil is pushed without using the 'delay' as i need the SwitchSil to be interrupted if a different button is pushed). buuuuuut back to the current issue....

int LED1 = 1;
int LED2 = 2;
int LED3 = 3;
int LED4 = 4; // Defining which pins are connected which component.
int LED5 = 5;
int LED6 = 6;

int Switch1 =A0;
int Switch2 =A1;
int Switch3 =A2;
int Switch4 =A3;
int Switch5 =A4;
int Switch6 =A5;
int SwitchSil =9;

int buzz =10;

//*for millis
const unsigned long silence = 3000; //
unsigned long previousTime = 0; //unsigned so the large value (0-4,000,000,000ish) can be held.

void setup () // Defining what each pins function is
{
pinMode (LED1 , OUTPUT);
pinMode (LED2 , OUTPUT);
pinMode (LED3 , OUTPUT);
pinMode (LED4 , OUTPUT);
pinMode (LED5 , OUTPUT);
pinMode (LED6 , OUTPUT);
pinMode (buzz , OUTPUT);

pinMode (Switch1 , INPUT);
pinMode (Switch2 , INPUT);
pinMode (Switch3 , INPUT);
pinMode (Switch4 , INPUT);
pinMode (Switch5 , INPUT);
pinMode (Switch6 , INPUT);
pinMode (SwitchSil , INPUT);

Serial.begin(115200);
}

void loop ()
{
// using Millis istead of a delay for silencer. (when silence button is hit, the buzzer is silence for x time
unsigned long currentTime = millis(); //millis is equal to the current time coz it starts counting when Arduino turns on.
}
//Buzzer!!*
if(digitalRead (SwitchSil) == LOW) // if the switch is open buzzer is pulled high so sounds / if the switch is closed buzzer is pulled low so silence
{
digitalWrite(buzz ,LOW) ; // If Switch is closed / (pulled low) Low= no buzz sound
(currentTime - previousTime >= silence)
previousTime - currentTime;
}
else // if switch is closed, turn buzz off
{
digitalWrite (buzz ,HIGH) ;
}

//LED1
if(digitalRead (Switch1) == LOW) // if the switch is open, turn LED on
{
digitalWrite(LED1 , LOW) ; // LED on
tone(buzz, 1000, OUTPUT); // if high/ switch open, buzz at ?Hz
}
else // if switch is closed, turn LED off
{
digitalWrite(LED1 , HIGH); // LED off and buzzer off
}
//LED 2
if(digitalRead (Switch2) == LOW) // if the switch is open, turn LED on
{
digitalWrite(LED2 , LOW) ; // LED on
tone(buzz, 1000, OUTPUT); // if high/ switch open, buzz at ?Hz
}
else // if switch is closed, turn LED off
{
digitalWrite(LED2 , HIGH); // LED off an buzzer off
}
//LED 3
if(digitalRead (Switch3) == LOW) // if the switch is open, turn LED on
{
digitalWrite(LED3 , LOW) ; // LED on
tone(buzz, 1000, OUTPUT); // if high/ switch open, buzz at ?Hz
}
else // if switch is closed, turn LED off
{
digitalWrite(LED3 , HIGH); // LED off and buzzer off
}
//LED 4
if(digitalRead (Switch4) == LOW) // if the switch is open, turn LED on
{
digitalWrite(LED4 , LOW) ; // LED on
tone(buzz, 1000, OUTPUT); // if high/ switch open, buzz at ?Hz
}
else // if switch is closed, turn LED off
{
digitalWrite(LED4 , HIGH); // LED off and buzzer off
}
//LED 5
if(digitalRead (Switch5) == LOW) // if the switch is open, turn LED on
{
digitalWrite(LED5 , LOW) ; // LED on
tone(buzz, 1000, OUTPUT); // if high/ switch open, buzz at ?Hz}
}
else // if switch is closed, turn LED off
{
digitalWrite(LED5 , HIGH); // LED off and buzzer off
}

//LED 6
if(digitalRead (Switch6) == LOW) // if the switch is open, turn LED on
{
digitalWrite(LED6 , LOW) ; // LED on
tone(buzz, 1000, OUTPUT); // if high/ switch open, buzz at ?Hz}
}
else // if switch is closed, turn LED off
{
digitalWrite(LED6 , HIGH); // LED off
}
}

Any help will be greatly appreciated

Your first issue is that your loop function ends on line 46. Any code after that is therefore not in a function, hence the errors.

Gosh!!! thank you soo much!! I wansnt looking anywhere near that!

Dumb0:
Gosh!!! thank you soo much!! I wansnt looking anywhere near that!

Sometimes (often) it helps to look at the OTHER error messages in the text box below your sketch. In this case you would have seen that the first error was at line 50. That would have gotten you close to the actual error: the extra '}' at line 48.

/Users/john/Documents/Arduino/sketch_aug26a/sketch_aug26a.ino: At global scope:
sketch_aug26a:50:2: error: expected unqualified-id before 'if'
  if(digitalRead (SwitchSil) == LOW) // if the switch is open buzzer is pulled high so sounds / if the switch is closed buzzer is pulled low so silence
  ^

Another good habit is to use Tools->Auto Format to neaten your sketch layout. Then you might have noticed that the 'if' statement in question started in column 1 (not indented) which means that it is not inside a function as is required. Then you would scroll up to find that all the statements after that errant '}' are starting in column 1. Deleting the '}' and doing another Auto Format will indent the statements properly.
The IDE editor is set to insert a '}' when you type '{' followed by Enter. This makes it easy to accidentally get an extra '}' where you don't want one. Be watchful.

The IDE editor is set to insert a '}' when you type '{' followed by Enter. This makes it easy to accidentally get an extra '}' where you don't want one

I have a love/hate relationship with that behavior. With it turned off I forget to enter closing braces but with it turned on I enter extra ones. I have settled on leaving the option turned on as it was always my habit to enter a closing } when entering a { anyway.