Logical And

Logical AND is a logical operation which has the following truth table:

More generally: This applies for any number of arguments to AND.

Stated another way (for C and C++ programmers, AND = &&)

Of course, in C, && is not LogicalAnd but rather ShortCircuitAnd? (the second argument is not evaluated unless the first argument is True).


Logical AND is not to be confused with the BitwiseAnd? operator. BitwiseAnd? operations are often used as a bit mask to clear certain bits without affecting others. For example, 00001111 AND 10101010 results in 00001010. (This was confusing when used in Commodore BASIC, because non-programmers think "and" means "plus": POKE 1,PEEK(1) AND 251 would clear bit 2, not add four.)


For those of us who need to use ThreeValuedLogic, Logical and has the following additional truth values:


CategoryLogic


EditText of this page (last edited April 27, 2005) or FindPage with title or text search