1. Computing & Technology

Discuss in my forum

Boolean Logic

By , About.com Guide

See More About:
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

©2012 About.com. All rights reserved.

A part of The New York Times Company.