UInt8

From Free Pascal wiki
Revision as of 04:45, 2 March 2020 by Trev (talk | contribs) (English translation of German page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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


Back to data types.


Range of values: 0 .. 255

Memory requirement: 1 byte or 8 bit

A data field of the UInt8 data type can only contain positive integer values.

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

Definition of a data field of type UInt8:

var 
  ui8 : uint8;

Examples of assigning valid values:

  ui8 := 0;
  ui8 := 255;

Examples of assigning invalid values:

  ui8 := '0';
  ui8 := '255';

The difference between the two examples is that the upper example is the assignment of literals of the type Integer, while the assignment of the lower example is literals of the type String.