[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Boolean Logical Values (TRUE, FALSE) Ordinal Type
The data type Boolean represents logical values that are either TRUE
or FALSE. Standard Pascal defines Boolean as an enumerated type:
type
Boolean = (False,True);
Thus, Ord(False) = 0, Ord(True) = 1, and False < True.
Boolean values, and particularly Boolean expressions, are important
because of their use in IF/THEN/ELSE statements, WHILE loops, and
REPEAT loops. The most common Boolean expression are those involving
relational operators: =, <>, <, >, <=, and >=. Standard Pascal also
has three Boolean operators--NOT, AND, OR--which combine Boolean
values and yield a Boolean result.
Boolean variables in Turbo Pascal occupy one byte. This is true even
if you declare a PACKED ARRAY OF Boolean or a PACKED RECORD with
Boolean fields. Turbo Pascal also introduces an additional Boolean
operator, XOR (exclusive OR).
-------------------------------- Example ---------------------------------
var
Iota,Able,Fred : Boolean;
begin
Iota := True; { Iota gets True }
Able := (3 >= 5); { Able gets False }
Fred := Iota or Able; { Fred gets True }
end.
See Also:
enumerated
records
arrays
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson