Wordbool

From Lazarus wiki

Deutsch (de) English (en) français (fr)


Back to data types.


Range of values: True .. False

Memory requirement: 2 bytes or 16 bits

A data field of the WordBool data type can only contain truth values.

Assigning other values ​​leads to compiler error messages when the program is compiled and the compilation process is aborted. This means that the executable program is not created.

The WordBool data type is used like the Boolean data type and the WordBool data type behaves like the Boolean data type.

Definition of a data field of the type WordBool:

  var 
    w : WordBool;

Examples of assigning valid values:

  w := True;
  w := false;
  w := 10 <> 20;  // The result of the comparison is true

Examples of assigning invalid values:

  w := 'True';
  w := 'False';
  w := '10 <> 20';
  w := 24;

The difference between the two examples is that the upper example is the assignment of literals of the type truth value, while the assignment of the lower example is literals of the type String and the type ShortInt.