Fixed - Help - Can anyone tell me why I have wmaybe-uninitialized warning

Hi,

I am quite new to coding but am learning slowly, I get this warning when I compile my code.

Warning: 'SW2D' may be used uninitialized in this function [-Wmaybe-uninitialized]

I cannot for the life of me see why so if some kind soul could take a look I would be grateful.

// named constants for the switch and motor pins
const int switch1 = 2; // the number of switch1 pin
const int switch2 = 4; // the number of the switch2 pin
const int RunNC = 5; // the number of the pin connected to relay contact NC
const int RunNO = 6; // the number of the pin connected to relay contact NO
const int motorpin = 12; // the number of the motor pin


  //Setup Channel A
 
 void setup() {
  // initialize the motor pin as an output:
  pinMode(motorpin, OUTPUT);
  // initialize switch pins as an input:
  pinMode(switch1, INPUT_PULLUP);
  pinMode(switch2, INPUT_PULLUP);
  pinMode(RunNC, INPUT_PULLUP);
  pinMode(RunNO, INPUT_PULLUP);
  //Brake the motor
  pinMode(9, OUTPUT);
}
 
void loop(){
int SW1D;                       // variable for reading the switch 1 delayed/debounced status
int Switch1State;                // variable to hold switch 1 state
int SW2D;                       // variable for reading the switch 2 delayed/debounced status
int Switch2State;                // variable to hold switch 2 state
int Closed = digitalRead(switch1);
int Open = digitalRead(switch2);
byte RunFlag;

  if (!digitalRead(RunNC) && digitalRead(RunNO)) {
    RunFlag = 1;  // relay is ON (energized)
  }
  if (digitalRead(RunNC) && !digitalRead(RunNO)) {
    RunFlag = 0;  // relay is OFF (de-energized)
  }

  Closed = digitalRead(switch1);      // read input value of switch 1 and store it in SW1D
  delay(10);                         // 10 milliseconds is a good amount of time
  SW1D = digitalRead(switch1);     // read the input again to check for bounces
  if (Closed == SW1D) {                 // make sure we got 2 consistant readings!
    if (Closed != Switch1State) {          // the switch 1 state has changed!
    }
    
  Open = digitalRead(switch2);      // read input value of switch 2 and store it in SW2D
  delay(10);                         // 10 milliseconds is a good amount of time
  SW1D = digitalRead(switch2);     // read the input again to check for bounces
  if (Open == SW2D) {                 // make sure we got 2 consistant readings!
    if (Open != Switch2State) {          // the switch 2 state has changed!
      
    }
  if (Closed == HIGH && Open == LOW && RunFlag == 1) {
     // Open the flap:
     digitalWrite(motorpin, HIGH); //Establishes forward direction of Channel A
     digitalWrite(9, LOW);   //Disengage the Brake for Channel A
     analogWrite(3, 255);   //Spins the motor on Channel A at full speed
     
  }
     else if (Closed == LOW && Open == LOW && RunFlag == 1) {
     // Open the flap:
     digitalWrite(motorpin, HIGH); //Establishes forward direction of Channel A
     digitalWrite(9, LOW);   //Disengage the Brake for Channel A
     analogWrite(3, 255);   //Spins the motor on Channel A at full speed
     
  }
  else if (Closed == LOW && Open == HIGH && RunFlag == 0) {
     // Close the flap:
     digitalWrite(motorpin, LOW); //Establishes backward direction of Channel A
     digitalWrite(9, LOW);   //Disengage the Brake for Channel A
     analogWrite(3, 255);   //Spins the motor on Channel A at full speed
  }
  else if (Closed == LOW && Open == LOW && RunFlag == 0) {
     // Close the flap:
     digitalWrite(motorpin, LOW); //Establishes backward direction of Channel A
     digitalWrite(9, LOW);   //Disengage the Brake for Channel A
     analogWrite(3, 255);   //Spins the motor on Channel A at full speed
  }
    else if (Closed == HIGH && Open == LOW && RunFlag == 0) {
     // stop the motor
     digitalWrite(9, HIGH);
    }
    else if (Closed == LOW && Open == HIGH && RunFlag == 1) {
     // stop the motor
     digitalWrite(9, HIGH);
    }
  Switch2State = Open;                 // save the new state in our variable
}
  Switch1State = Closed;                 // save the new state in our variable
    }
  }

Nevermind have found the problem in this line

SW1D = digitalRead(switch2); // read the input again to check for bounces

It should be :

SW2D = digitalRead(switch2); // read the input again to check for bounces