if , Else, && and || statements .... need advice

I am new to programming and have some issues with the && and || commands. They do not perform as anticipated. The code below aim to do the following: (Work with a combination of switches)
The 3 statements:
If now switches pressed, If switch in pin 2 is press with all the other switches. If if switch in pin 2 is pressed and any of the other switches is not pressed. The last 2 command is not working as intended.

NOTE: the switches used here read HIGH when not pressed.

int switchstate = 0;
int switchstateB = 0;
int switchstateC = 0;
int switchstateD = 0;

void setup(){
pinMode(3,OUTPUT);
pinMode(7,OUTPUT);

pinMode(2,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
pinMode(6,INPUT);

}

void loop(){

switchstate = digitalRead(2);
switchstateB = digitalRead(4);
switchstateC = digitalRead(5);
switchstateD = digitalRead(6);

if (digitalRead(2) == HIGH && digitalRead(4) == HIGH && digitalRead(5) == HIGH && digitalRead(6) == HIGH ) {
digitalWrite (3, HIGH);
digitalWrite (7, HIGH);
}

else if (digitalRead(2) == LOW && digitalRead(4) == LOW && digitalRead(5) == LOW && digitalRead(6) == LOW ) {
digitalWrite(7,LOW);
digitalWrite (3,HIGH);
}
else if (digitalRead(2) == LOW && digitalRead(4) == HIGH || digitalRead(5) == HIGH || digitalRead(6) == HIGH ) {
digitalWrite(7,HIGH);
digitalWrite (3,LOW);
}
}

Add parentheses, mixing && and || in the same condition will confuse you and anyone
else reading your code otherwise:

Either put:

  if (a && (b || c))

or

  if ((a && b) || c)

but never

  if (a && b || c)

Because even if you know the precedence rules for C++, these things vary between
languages and also are often ambigous in normal speech anyway.

These are HIGH when not pressed because you have external pullups?

pinMode(2,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
pinMode(6,INPUT);

Could use the internal pullups instead:

pinMode(2,INPUT_PULLUP);
pinMode(4,INPUT_PULLUP);
pinMode(5,INPUT_PULLUP);
pinMode(6,INPUT_PULLUP);

Why define these & then not use them?
int switchstate = 0;
int switchstateB = 0;
int switchstateC = 0;
int switchstateD = 0;

Try taking the else's out so it's just 3 if statements.

Thank you for sharing your knowledge..... slowly seeing the light :astonished:

Will implement both suggestions, seems like keeping code logical is a good beginning...