|
|
Line 1: |
Line 1: |
− | {{Int16}}
| + | #REDIRECT [[Integer]] |
− | | |
− | | |
− | Back to [[Data type|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:
| |
− | | |
− | <syntaxhighlight lang=pascal>
| |
− | var
| |
− | i16 : int16;
| |
− | </syntaxhighlight>
| |
− | | |
− | Examples of assigning valid values:
| |
− | | |
− | <syntaxhighlight lang=pascal>
| |
− | i16 := - 32768;
| |
− | i16 := 0;
| |
− | i16 := 32767;
| |
− | </syntaxhighlight>
| |
− | | |
− | Examples of assigning invalid values:
| |
− | | |
− | <syntaxhighlight lang=pascal>
| |
− | i16 := '-32768';
| |
− | i16 := '0';
| |
− | i16 := '32767';
| |
− | </syntaxhighlight>
| |
− | | |
− | 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]].
| |