1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Boolean Logic

By

Definition: Boolean logic is a type of decision making utilized by computers to decide if a statement is true or false. There are four main boolean operators used to evaluate a statement as true or false. They are:

&& - true if both operands are true
|| - true if at least one operand is true
xor - true if ONLY one operand is true
! - true if a single operand is false

Examples:

A is True
B is True
C is False

A && B
This is asking for A and B to both be true, since they are both true, this expression is TRUE

A || C
This is asking for A or C to be true. Again this is a TRUE expression

A xor B
This is asking for A or B but not both, to be true. Since they are both true, this expression is FALSE

!A
This is asking for A to be false. Since A is true, this expression is FALSE

!C
This is asking for C to be false. Since C is false, this expression is TRUE

  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Programing Glossary
  5. Boolean Operator - Boolean Algebra - Boolean Logic

©2014 About.com. All rights reserved.