Does not name a type error

Hello, I have started a program. Basically its multiple push button switches that act as toggle switches. The first button worked so I copy and pasted the code and edited the inputs and outputs but now I am running into an error 'newSwitchState' does not name a type. I am not sure what to do to remove the error. I have tried declaring multiple 'newSwitchStates' for each switch but that didn't work. Can somebody help me find the error?

const int buttonPin1 = 2; //The number of the pushbutton pin
const int buttonPin2 = 3; //The number of the pushbutton pin
const int buttonPin3 = 4; //The number of the pushbutton pin
const int buttonPin4 = 5; //The number of the pushbutton pin
const int buttonPin5 = 6; //The number of the pushbutton pin
const int buttonPin6 = 7; //The number of the pushbutton pin

const int ledPin1 = 8; //The number of the LED pin
const int ledPin2 = 9; //The number of the LED pin
const int ledPin3 = 10; //The number of the LED pin
const int ledPin4 = 11; //The number of the LED pin
const int ledPin5 = 12; //The number of the LED pin
const int ledPin6 = 13; //The number of the LED pin

//Variables will change:
int buttonState = 0; // Variable for reading the pushbutton status
boolean oldSwitchState=LOW;
boolean newSwitchState=LOW;
boolean LEDstatus=LOW;
void setup()
{
pinMode(2,INPUT); //Initialize the Pushbutton as an input
pinMode(3,INPUT); //Initialize the Pushbutton as an input
pinMode(4,INPUT); //Initialize the Pushbutton as an input
pinMode(5,INPUT); //Initialize the Pushbutton as an input
pinMode(6,INPUT); //Initialize the Pushbutton as an input
pinMode(7,INPUT); //Initialize the Pushbutton as an input
pinMode(8,OUTPUT); //Initiate the LED Pin as an Output
pinMode(9,OUTPUT); //Initiate the LED Pin as an Output
pinMode(10,OUTPUT); //Initiate the LED Pin as an Output
pinMode(11,OUTPUT); //Initiate the LED Pin as an Output
pinMode(12,OUTPUT); //Initiate the LED Pin as an Output
pinMode(13,OUTPUT); //Initiate the LED Pin as an Output
}

void loop()
{
newSwitchState = digitalRead(2); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

if (newSwitchState != oldSwitchState)//Has the switch been closed
{
if (newSwitchState==HIGH)
{
if (LEDstatus==LOW) {digitalWrite(ledPin1,HIGH); LEDstatus=HIGH;}
else {digitalWrite(ledPin1,LOW); LEDstatus=LOW;}
}
}
oldSwitchState=newSwitchState;

}

newSwitchState = digitalRead(3); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

if (newSwitchState != oldSwitchState)//Has the switch been closed
{
if (newSwitchStat1==HIGH)
{
if (LEDstatus==LOW) {digitalWrite(ledPin2,HIGH); LEDstatus=HIGH;}
else {digitalWrite(ledPin2,LOW); LEDstatus=LOW;}
}
}
oldSwitchState=newSwitchState;

}

newSwitchState = digitalRead(4); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

if (newSwitchState != oldSwitchState)//Has the switch been closed
{
if (newSwitchState==HIGH)
{
if (LEDstatus==LOW) {digitalWrite(ledPin3,HIGH); LEDstatus=HIGH;}
else {digitalWrite(ledPin3,LOW); LEDstatus=LOW;}
}
}
oldSwitchState=newSwitchState;

}

newSwitchState = digitalRead(5); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

if (newSwitchState != oldSwitchState)//Has the switch been closed
{
if (newSwitchState==HIGH)
{
if (LEDstatus==LOW) {digitalWrite(ledPin4,HIGH); LEDstatus=HIGH;}
else {digitalWrite(ledPin4,LOW); LEDstatus=LOW;}
}
}
oldSwitchState=newSwitchState;

}

newSwitchState = digitalRead(6); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

if (newSwitchState != oldSwitchState)//Has the switch been closed
{
if (newSwitchState==HIGH)
{
if (LEDstatus==LOW) {digitalWrite(ledPin5,HIGH); LEDstatus=HIGH;}
else {digitalWrite(ledPin5,LOW); LEDstatus=LOW;}
}
}
oldSwitchState=newSwitchState;

}

newSwitchState = digitalRead(7); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

if (newSwitchState != oldSwitchState)//Has the switch been closed
{
if (newSwitchState==HIGH)
{
if (LEDstatus==LOW) {digitalWrite(ledPin6,HIGH); LEDstatus=HIGH;}
else {digitalWrite(ledPin6,LOW); LEDstatus=LOW;}
}
}
oldSwitchState=newSwitchState;
}
}

ac_circuits_final2.ino (4.6 KB)

newSwitchState = digitalRead(3); //Read the state of the Pushbutton Value:

This line of code and many after it are not in a function. Check carefully where the loop() function ends

Auto formatting the code in the IDE shows up the problem

void loop()
{
  newSwitchState = digitalRead(2); //Read the state of the Pushbutton Value:
  //Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.
  if (newSwitchState != oldSwitchState)//Has the switch been closed
  {
    if (newSwitchState == HIGH)
    {
      if (LEDstatus == LOW)
      {
        digitalWrite(ledPin1, HIGH);
        LEDstatus = HIGH;
      }
      else
      {
        digitalWrite(ledPin1, LOW);
        LEDstatus = LOW;
      }
    }
  }
  oldSwitchState = newSwitchState;
}

newSwitchState = digitalRead(3); //Read the state of the Pushbutton Value:
//Check if the Pushbutton is pressed. If it is, the buttonState is HIGH, if it is not, then the buttonState is Low.

etc
etc

Note the use of code tags when posting code to make it easier to copy to an editor for examination