From Lazarus wiki
Jump to navigationJump to search

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

Back to data types.

Range of values: -32768 .. 32767

Memory requirement: 2 bytes or 16 bits

A data field of the Int16 data type can only contain integer values ​​with and without sign. 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.

Declaration of a data field of type Int16:

    i16 : int16;

Examples of assigning valid values:

    i16 := - 32768;
    i16 := 0;
    i16 := 32767;

Examples of assigning invalid values:

    i16 := '-32768';
    i16 := '0';
    i16 := '32767';

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.