Previous: Types To the Table of Content Next: Character Types

- 2.2.6.1 -
TMT Pascal Language Description
Pascal Language Structure
Types

Boolean Types

The TMT Pascal compiler has four predefined Boolean types which are Boolean (preferred), ByteBool, WordBool, and LongBool.

The Boolean and ByteBool variables occupy one byte of memory, a WordBool variable occupies two bytes, and a LongBool variable occupies four bytes. Each Boolean type is an ordinal and can hold one of two values: True or False. Expressions that evaluate to a logical "yes" or "no" are of Boolean type. if, while, repeat and other control statements work with Boolean expressions. The following code fragment,
while not KeyPressed do ;
causes program execution to pause until a key is pressed on the keyboard. KeyPressed is a procedure declared in the CRT unit. The expression not KeyPressed results in a Boolean value that determines whether the while loop is executed.

not performs a logical NOT on the Boolean returned by KeyPressed.

The constants True and False are declared in the System unit as Boolean.

The evaluation model is controlled through the $B compiler directive. The default state is {$B-}, so the compiler generates short-circuit evaluation code. In the {$B+} state, the compiler generates a complete evaluation.


Previous: Types To the Table of Content Next: Character Types
Types Table of Content Character Types

- 2.2.6.1 -