OPERATOR:  logical:  &&  ||  !

The logical operators are used to perform Boolean operations.
 
There are three logical operators:
 
 && 
The && is the logical AND operator. This operator performs a Boolean test on two operands. If both operands are true, then a true is returned. If either or both operands is false, false is returned. If the first operand that is tested proves to be invalid, the second operand is not tested, and invalid is returned. Similarly, if the second operand is invalid, invalid is returned.
 
 || 
The || is the logical OR operator. This operator performs a Boolean test on two operands. If either or both operands test true, a true is returned. If both operands test false, a false is returned. If the first operand that is tested proves to be invalid, the second operand is not tested, and invalid is returned. Similarly, if the second operand is invalid, invalid is returned.
 
 ! 
The ! is the logical NOT operator which is used to perform a logical negation on a Boolean (true or false) expression. This operator causes a true expression to become false, and a false expression to become true.
 
Code fragment:
...
var YouAndMe = (IAm && YouAre) || (IAm && !YouAre);
...


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information