Finished with first program, can I get a look over?

   #include <Servo.h> //servo library
    
    Servo servoarm9;  // create servo object to control a servo 
    Servo servoswitch10; // create servo object to control a servo
    
    int pos = 0;    // variable to store the servo position
    
    // this constant won't change:
    const int switchPin8 = 8;
    const int pwmA = 3;
    const int pwmB = 11;
    const int brakeA = 9;
    const int brakeB = 8;
    const int dirA = 12;
    const int dirB = 13;
    
    // Variables will change:
    int switchCounter = 0;   // counter for the number of button presses
    int switchState = 0;       // current state of the button
    int lastSwitchState = 0;   // previous state of the button
    
    void setup() 
    {
    pinMode(switchPin8, INPUT);  // set the switch pin to be an input
    servoarm9.attach(9);   // attaches the servo on pin 9 to the servo object
    servoswitch10.attach(10); //attaches the servo on pin 10 to the servo object
    //Setup Channel A
    pinMode(dirA, OUTPUT); //Initiates Motor Channel A pin
    pinMode(brakeA, OUTPUT); //Initiates Brake Channel A pin
    //Setup Channel B
    pinMode(dirB, OUTPUT); //Initiates Motor Channel B pin
    pinMode(brakeB, OUTPUT); //Initiates Brake Channel B pin
    Serial.begin(9600);
    }
    
    void loop() 
    {
    switchState = digitalRead(switchPin8); // read the switch input pin
    if (switchState != lastSwitchState) // compare the switchState to its previous state 
    {
    if (switchState == HIGH) // if the state has changed, increment the counter
    {
    switchCounter++;
    Serial.println("on");
    Serial.print("number of button pushes:  ");
    Serial.println(switchCounter);
    } 
    
    else 
    {
    Serial.println("off"); 
    } 
    }
    lastSwitchState = switchState; // save the current state as the last state, for next time through the loop
    // turns on the servo every 10 pushes by 
    // checking the modulo of the button push counter.
    // the modulo function gives you the remainder of 
    // the division of two numbers:
    if (switchCounter % 10 == 0) 
    {
    //Motor A forward @ full speed
    digitalWrite(dirA, HIGH); //Establishes forward direction of Channel A
    digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
    analogWrite(pwmA, 255); //Spins the motor on channel A at full speed
    //Motor B forward @ full speed
    digitalWrite(dirB, HIGH); //Establishes forward direction of Channel B
    digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
    analogWrite(pwmB, 255);
    delay(3000);
    
    digitalWrite(brakeA, HIGH); //Engage the Brake for Channel A
    digitalWrite(brakeB, HIGH); //Engage the Brake for Channel B
    delay(1000);
    
    //Motor A backwards @ full speed
    digitalWrite(dirA, LOW); //Establishes backward direction of Channel A
    digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
    analogWrite(pwmA, 255); //full speed
    //Motor B backwards @ half speed
    digitalWrite(dirB, LOW); //Establishes backward direction of Channel B
    digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
    analogWrite(pwmB, 127); //half speed
    delay(3000);
 
    //Motor A forward @ half speed
    digitalWrite(dirA, HIGH); //Establishes forward direction of Channel A
    digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
    analogWrite(pwmA, 127); //half speed
    //Motor B forward @ full speed
    digitalWrite(dirB, HIGH); //Establishes forward direction of Channel B
    digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
    analogWrite(pwmB, 255); //full speed
    delay(3000); 
  
    //Motor A backwards @ full speed
    digitalWrite(dirA, LOW); //Establishes backward direction of Channel A
    digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
    analogWrite(pwmA, 255); //full speed
    //Motor B backwards @ half speed
    digitalWrite(dirB, LOW); //Establishes backward direction of Channel B
    digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
    analogWrite(pwmB, 127); //half speed
    delay(3000);
  
    //Motor A forward @ half speed
    digitalWrite(dirA, HIGH); //Establishes forward direction of Channel A
    digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
    analogWrite(pwmA, 127); //half speed
    //Motor B forward @ full speed
    digitalWrite(dirB, HIGH); //Establishes forward direction of Channel B
    digitalWrite(brakeB, LOW); //Disengage the Brake for Channel B
    analogWrite(pwmB, 255); //full speed
    delay(3000);  
   
    digitalWrite(brakeA, HIGH); //engage the Brake for Channel A
    digitalWrite(brakeB, HIGH); //engage the Brake for Channel B
    
    for(pos = 0; pos < 90; pos += 1)  // goes from 0 degrees to 90 degrees, in steps of 1 degree                              
    servoswitch10.write(pos);          // tell servo to go to position in variable 'pos' 
    delay(15);
    } 
    else 
    {
    // if the switch is closed:
    for(pos = 0; pos < 90; pos += 1)  // goes from 0 degrees to 90 degrees // in steps of 1 degree                              
    servoarm9.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15); 
    for(pos = 90; pos>=1; pos-=1)     // if the switch is open:// goes from 90 degrees to 0 degrees                               
    servoarm9.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15); 
    }
    }

Please use the auto format tool in the IDE before posting.
What's the problem?

You have this block of code or similar repeated a lot

    //Motor A backwards @ full speed
    digitalWrite(dirA, LOW); //Establishes backward direction of Channel A
    digitalWrite(brakeA, LOW); //Disengage the Brake for Channel A
    analogWrite(pwmA, 255); //full speed

I would make a function with a few parameters to reduce all that code.


Rob

The indentation is a bit nasty in places.

There are also some for loops where I suspect you intended the body of the loop to contain multiple statements, but because you haven't enclosed them in a compound statement only the first statement will be executed by the for loop. For example:

    for(pos = 0; pos < 90; pos += 1)  // goes from 0 degrees to 90 degrees, in steps of 1 degree                              
    servoswitch10.write(pos);          // tell servo to go to position in variable 'pos' 
    delay(15);

I recommend that you follow every for, do, while, if, else and so on with an opening { on a line on its own, and follow that with a matching } on a line on its own indented to the same depth. Everything enclosed between them should be indented one extra level.

Comments noting that constants are constant and variables are variable don't contribute much to understanding the code. For example, a comment indicating that a group of declarations are defining the hardware pins and values used by your sketch would seem more useful. Similarly, the comment "tell servo to go to position in variable 'pos'" doesn't tell you anything that isn't obvious from the code, but it might be helpful to know what this range of angles represents, what has determined the speed, or why it's appropriate to move the servo at this point. I'd also recommend that where you have hard-coded values such as 0, 90, 15 here that obviously represent significant things in the real world you consider replacing these hard-coded values with corresponding constants. So, for example, if you need to adjust the range of travel of your servo, or the speed, you can do this easily since they are each defined in one place.

You seem to declare two servos (i haven't look at what they're used for) but only one variable storing the current servo position. I assume that relates to one of the servos. In that case I would suggest you adopt a naming convention which makes it more obvious when several variables are related - for example, the servo and the variable holding the current position of that servo.

By including '8' in the name of switchPin8 you negate the possibility of the pin assignment changing in future. It is better for that constant declaration to encapsulate the assignment, such that no code anywhere else would be affected if the assignment needs to change.

What are the servos doing? Do you really need to move them one degree at a time, or could you just get rid of the for loops and move them directly to the required end position?