Previous: 2.2.6. Types To the Table of Contents Next: 2.2.6.2. Character Types
2.2.6. Types Table of Contents 2.2.6.2. Character Types

- 2.2.6.1. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
2.2.6. Types
2.2.6.1. Boolean Types


2.2.6.1. 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: 2.2.6. Types To the Table of Contents Next: 2.2.6.2. Character Types
2.2.6. Types Table of Contents 2.2.6.2. Character Types

- 2.2.6.1. -