my code for the scouting does't work please help

hello why does my code not work

int switchstate = 0;
int switchstatea = 0;

void setup(){
// declare the LED pins as outputs
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);

// declare the switch pin as an input
pinMode(12,INPUT);
pinMode(11,INPUT);
}

void loop(){

// read the value of the switch
// digitalRead() checks to see if there is voltage
// on the pin or not
switchstate = digitalRead(12);
switchstatea = digitalRead(11);

// if the button is not pressed

if (switchstate == LOW) { // turn of the leds
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);

}
// this else is part of the above if() statement.
// if the switch is HIGH (the button is pressed)
// the code below will run
else {

if (switchstatea == LOW) {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
// wait for a half second before changing the light
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
delay(500);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
delay(2000);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
}
else {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
// wait for a half second before changing the light

}
}
}

you need to learn to use FOR loop

   digitalWrite(2, LOW);
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW);  
    digitalWrite(5, LOW);  
    digitalWrite(6, LOW);
    digitalWrite(7, LOW);
    digitalWrite(8, LOW);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);
for (int i=2; i<11; i++) digitalWrite(i, LOW);

That will save a lot of typing.

and (2) use code tags ==> # button above smiley’s

hello why does my code not work

you don't tell us what you expect it to do....

OK As others have said, YOU DON’T TELL US WHAT IT’S SUPPOSED TO DO.
But with a bit of reverse engineering I’ve rewritten it in a form that will be hopefully be easier to maintain (and for you to spot the error in your logic.

void setup(){
int n;
//SET PINS 2-10 AS OUTPUT
for(n=2;n<11;n++)
  {pinMode(n,OUTPUT);
   digitalWrite(n,LOW);
  }
// declare the switch pin as an input   
  pinMode(12,INPUT);
  pinMode(11,INPUT);
}

void loop(){
int switchstate=2*digitalRead(12)+ digitalRead(11);
//switch logic (easier to get head around active high)
switchstate=switchstate^3;
//switchstate now holds the following value
//0 neither swtich active
//1 switch on pin 11 active 
//2 switch on pin 12 active 
//3 both switches active;

int n;//used in loops

switch(switchstate)
   { //pin 12 active (irrespecive of pin 11s state)
     case 2: case 3:
           digitalWrite(2,LOW);
           break;          
    case 1://pin 11 active
       //TURN ON OUTPUTS ONE AT A TIME
       for(n=3;n<11;n++)
         {digitalWrite(n,HIGH);
           delay(500);
         }
         //WAIT 2 SECONDS
         delay(2000);
         //SET ALL OUTPUTS LOW
       for(n=2;n<11;n++)
         digitalWrite(n,LOW);
         break;
         
      case 0://No switches active
        digitalWrite(2,HIGH);
       break; 
  }
}

You’ll notice that when the loop starts to run, pins 3-10 are already low. The only case where they are set to HIGH are when you press the switch on pin 11; But this also sets them back to low again before it exits. So there is no point setting them to low for the shear hell of it.