'&&'
The logical-AND operator produces the value 1 if both operands have nonzero
values. If either operand is equal to 0, the result is 0. If the first operand of a
logical-AND operation is equal to 0, the second operand is not evaluated.
'||'
The logical-OR operator performs an inclusive-OR operation on its operands.
The result is 0 if both operands have 0 values. If either operand has a nonzero
value, the result is 1. If the first operand of a logical-OR operation has a nonzero
value, the second operand is not evaluated.
Gli operandi di espressioni logiche-AND e OR logico vengono valutate da sinistra a destra. Se il valore del primo operando è sufficiente per determinare il risultato dell'operazione, il secondo operando non viene valutato. Questo è chiamato "valutazione di cortocircuito". C'è un punto di sequenza dopo il primo operando.
Grazie, :)
fonte
2012-07-23 18:11:47
in realtà, qual è il tuo requisito principale? perché stai per assegnare queste variabili? –