DC motor and 3 momentary switches

Hi,
I'm trying to program the following:
I have a DC motor and 3 momentary swithes which are marking a position
when Switch 1 is pushed Motor starts and turns until Switch 2 turn momentary ON
Motor lowers the speed until Switch 3 turns ON then Motor direction changes and
we go back to Switch 2.
I tried with if/else but it doesn't work
I attached my "work", obvously I'm a neubie

regards
Mario

// constants won't change. They're used here to
// set pin numbers:
const int reedPin1 = 4;     // the number of the pushbutton pin
const int reedPin2 = 7;
const int reedPin3 = 8;
const int startPin = 2;     // the number of the pushbutton pin
const int motorPin = 11;      // the number of the motor pin
const int ledPin = 13;      // the number of the motor pin
const int dirPin = 12;

// variables will change:
int reed1State = 0;         // variable for reading the reedSensor status
int reed2State = 0;
int reed3State = 0;
int startState = 0;


void setup() {
  // initialize the motor pin as an output:
  pinMode(motorPin, OUTPUT);
  // initialize the direction pin as an output:
  pinMode(dirPin, OUTPUT);

  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(reedPin1, INPUT);

  pinMode(reedPin2, INPUT);

  pinMode(reedPin3, INPUT);

  pinMode(startPin, INPUT);
}

void loop() {

  int startState = digitalRead(startPin);
  //reed1State = digitalRead(reedPin1);
  int reed2State = digitalRead(reedPin2);
  int reed3State = digitalRead(reedPin3);


  if (startState == LOW && reed2State == LOW && reed3State == LOW){
  
  analogWrite(motorPin, 0);
      digitalWrite(dirPin, LOW);
      delay(5);
                                } else {
  

  if (startState == HIGH && reed2State == LOW && reed3State == LOW){

      analogWrite(motorPin, 0);
      digitalWrite(dirPin, LOW);
      delay(5);
      analogWrite(motorPin, 50);
      delay(200);
                                } else {
                                  
if (startState == HIGH && reed2State == HIGH && reed3State == LOW){

      analogWrite(motorPin, 0);
      digitalWrite(dirPin, LOW);
      delay(5);
      analogWrite(motorPin, 100);
      delay(200);

                              } else {
                                
      if (startState == HIGH && reed2State == LOW && reed3State == HIGH){
      analogWrite(motorPin, 0);
      digitalWrite(dirPin, HIGH);
      delay(5);
      analogWrite(motorPin, 100);
      delay(200);
                              } else {
 digitalWrite(ledPin, LOW);
}
}}}}

How are your switches wired? You are not using the internal pullup resistors, so you need external pullup or pulldown resistors. Do you have them? Why? Why aren't you using the internal ones, and the far simpler wiring that they support?

I tried with if/else but it doesn't work

The code does something. We can't see what it does, and you didn't explain what it does.

All we know at this point is that the code does not do what you expect.

Put every { on a line BY ITSELF.
Put every } on a line BY ITSELF.
Use Tools + Auto Format to fix that horrid indenting.

I suspect that you need to look at the state change detection example, and do something only when the start switch BECOMES pressed.

I suspect that you need to use nested if statements, not compound if statements. There is something to do when the start switch is pressed that has nothing to do with the state of the other switches. Trying to use compound if statements instead of nested if statements makes for very difficult to understand code, especially when there are NO comments in the code.