Difference between revisions of "Int8"

From Free Pascal wiki
Jump to navigationJump to search
(English translation of German page)
 
m (Tidy up code)
Line 16: Line 16:
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
 
   var  
 
   var  
     i8 : int8 ;
+
     i8 : int8;
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 22: Line 22:
  
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
     i8 : = - 128 ;
+
     i8 := -128;
     i8 : = 0 ;
+
     i8 := 0;
     i8 : = 127 ;
+
     i8 := 127;
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 30: Line 30:
  
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
     i8 : = '-128' ;
+
     i8 := '-128';
     i8 : = '0' ;
+
     i8 := '0';
     i8 : = '127' ;
+
     i8 := '127';
 
</syntaxhighlight>
 
</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]].
 
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]].

Revision as of 07:40, 18 February 2020

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


Back to data types.


Range of values: -128 .. 127

Memory requirement: 1 byte or 8 bits

A data field of the Int8 data type can only accept 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.

Definition of a data field of type Int8:

  var 
    i8 : int8;

Examples of assigning valid values:

    i8 := -128;
    i8 := 0;
    i8 := 127;

Examples of assigning invalid values:

    i8 := '-128';
    i8 := '0';
    i8 := '127';

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.