The true value can be assigned directly to a boolean variable or from the result of a comparison or test that was successful ("true"). Similarly the false value can be assigned directly or from the result of a comparison or test that was not successful ("false"). The Write() and Writeln() procedures will print a string that corresponds to the value of a Boolean variable (either "TRUE" or "FALSE"). A Boolean variable can be used as the expression in an if statement. The WriteStr() procedure can be used to store a string literal representing a Boolean variable's value in a string variable.
var tooLarge : Boolean = false; boolString : ShortString; begin Writeln(tooLarge); tooLarge := (0 = 0); Writeln(tooLarge); tooLarge := (3 > 5); Writeln(tooLarge); tooLarge := true; Writeln(tooLarge); if tooLarge then Writeln('tooLarge is true') else Writeln('tooLarge is false'); WriteStr(boolString,tooLarge); Writeln(boolString); end
tooLarge is true
|Simple Data Types||Boolean | Byte | Cardinal | Char | Currency | Extended | Int64 | Integer | Longint | Pointer | Real | Shortint | Smallint | Word|
|Complex Data Types||Array | Class | Record | Set | String | ShortString|