Boolean Data Type - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Boolean Data Type.
Encyclopedia Article

Boolean Data Type - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Boolean Data Type.
This section contains 230 words
(approx. 1 page at 300 words per page)

Boolean data consist of binary information stored in data files. Boolean data are often distinguished from text, which consists of textual information stored in text files (files in which characters are represented by their ASCII codes).

Data types classify the various types of data stored in a computer, such as character, real number, integer number, floating point number, Boolean data, and pointers. Boolean data (sometimes also called binary data) are used to express the truth-values of propositions. Boolean data are of a type that computers can easily support. Computers ultimately recognize only two distinct Boolean data values, zero or FALSE and 1 or TRUE.

A simple program using Boolean data is as follows:

  • HOTDAY : Boolean; // declaration of variable HOTDAY as Boolean type
  • HOTDAY = (temperature > 85); // assignment of truth value to variable HOTDAY

Above, HOTDAY is declared a Boolean variable. By definition, the only possible values of HOTDAY are 1 (TRUE) and 0 (FALSE). HOTDAY will be assigned a value of TRUE if the temperature is greater than 85, and a value of FALSE if the temperature is equal to or less than 85.

Of course, a variable of almost any data type (character, integer, or other) could be used to store "0" and "1" values and thus be made to function as a Boolean-type variable. However, employing the Boolean data type proper makes more efficient use of memory and requires less complex code.

This section contains 230 words
(approx. 1 page at 300 words per page)
Copyrights
Gale
Boolean Data Type from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.