'&&'
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.
Các toán hạng của các biểu thức logic-AND và logic-OR được đánh giá từ trái sang phải. Nếu giá trị của toán hạng đầu tiên là đủ để xác định kết quả của phép toán, toán hạng thứ hai không được đánh giá. Điều này được gọi là "đánh giá ngắn mạch". Có một điểm chuỗi sau toán hạng đầu tiên.
Xin cảm ơn, :)
Nguồn
2012-07-23 18:11:47
thực sự, yêu cầu chính của bạn là gì? tại sao bạn định gán biến này? –