Next: Character Type
Up: Data Types
Previous: Complex Type
The logical data type is mainly used in conjunction with IF
statements which select a course of action according to whether
some condition is true or false. A logical variable (or array
element) may be used to store such a condition value for future
use. Logical variables and arrays are also useful when dealing
with two-valued data such as whether a person is male or female,
a file open or closed, power on or off, etc.
Some programmers seem reluctant to use logical variables and
arrays because they feel that it must be inefficient to use an entire
computer word of perhaps 32 bits to store just one bit of
information. In fact the extra code needed to implement a more
efficient data packing scheme usually wastes more memory than
the logical variables would have occupied.
Helen Rowlands
8/27/1998