Difference between revisions of "Int8"

From Lazarus wiki
Jump to navigationJump to search
(English translation of German page)
 
(de-duplicate page contents, entire information now present in Integer)
Tag: New redirect
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Int8}}
+
#REDIRECT [[Integer]]
 
 
 
 
Back to [[Data type|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:
 
 
 
<syntaxhighlight lang=pascal>
 
  var
 
    i8 : int8 ;
 
</syntaxhighlight>
 
 
 
Examples of assigning valid values:
 
 
 
<syntaxhighlight lang=pascal>
 
    i8 : = - 128 ;
 
    i8 : = 0 ;
 
    i8 : = 127 ;
 
</syntaxhighlight>
 
 
 
Examples of assigning invalid values:
 
 
 
<syntaxhighlight lang=pascal>
 
    i8 : = '-128' ;
 
    i8 : = '0' ;
 
    i8 : = '127' ;
 
</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]].
 

Latest revision as of 20:09, 6 November 2022

Redirect to: