True only if both operands are true, e.g.
if (digitalRead(2) == HIGH && digitalRead(3) == HIGH) { // read two switches
// ...
}
is true only if both inputs are high.
I was wondering whether it woks with outputs like this
Yes, "Input" here refers to the inputs to the && operator, not the inputs to the Arduino. In addition, && short circuits. If the first input is false, rest of the expression is not evaluated since it has to be false.
You're missing some digitalRead()s in there I think.
"ledpin" and "ledpin2" appear to be variable names. So you are comparing the contents of the variable "ledpin" to the macro "HIGH". Not the state of the pin referred to by "ledpin".
So in other words, your if statement could read like:
int ledpin = 2; // example of bad variable name
int ledpin2 = 3; // example of a REALLY bad variable name
if ((ledpin == HIGH) && (ledp2in == HIGH))
// becomes
if ((2 == HIGH) && (3 == HIGH)) // this will never evaluate true, because
// actually evaluates as
if ((2 == 1) && (3 == 1)) // clearly, can't be true.