# Difference between Boolean and Bool

##### Key Difference: Boolean is generally used in context to a deductive logical system known as Boolean Algebra. In the field of computers and electronics, Boolean refers to a data type that has two possible values representing true and false. Thus, it is also a keyword for a type that is used in various programming languages to represent Boolean variables or constants. Bool is also used as an alias to Boolean. It is also a keyword to represent Boolean variables or constants.

Boolean is used as an adjective to denote any entity that may have any value among the two possible values. It is named after a system of algebric notation that was created by George Boole. The system can be defined by the occurrence of two states – True or False. (1, yes, on) are regarded as equivalent to true, whereas (0, no, off) are regarded as equivalent to false. Thus, we can say that Boolean Algebra is based on a binary system. It uses operators to determine the comparison between the bits. Boolean also exists in the form of a keyword to represent a type that holds only True or False value. In Visual Basic, the default value of Boolean is false. During the conversion of numeric data type values to Boolean, 0 becomes false and rest of the values become true. Examples of boolean as a type are listed below -

Dim agree As Boolean

If Number = 5 Then

agree = True

End If

Another example -

boolean valid = true;

if (valid)

{

<statement>

}

Bool is a short name for Boolean. The word is also used as a keyword in various programming languages. The underlying definition of the keyword remains the same as for boolean. It is used to describe a variable that has the possibility of either true or false. Sometimes true is also denoted as 1 and false is also denoted as 0. In C++,  bool keyword is used in field, method, property, and variable declarations and in cast and typeof operations as an alias for the .NET Framework structure System.Boolean. It means that it represents a value of true or false. In C++ boolean is actually an integer. However, a bool in C# is a data type that cannot be casted to any other primitive type.

Example in C++

bool bValue = true;

if (!bValue)

cout << "Hello" << endl;

else

cout << "Bye" << endl;

Comparison between Boolean and Bool:

 Boolean Bool Definition In the field of computers and electronics, Boolean refers to a data type that has two possible values representing the true and false. It is generally used in context to a deductive logical system known as Boolean Algebra. It is also a keyword for a type in various programming languages to represent Boolean variables or constants. Bool is also used as an alias to Boolean. It is also a keyword to represent Boolean variables or constants. Usage Type and Adjective Type Data Type Java, VB C++, C#

Image Courtesy: suesauer.blogspot.com, cs.uah.edu