DelphiBasics
ShortInt
Type
An integer type supporting values -128 to 127 System unit
  type ShortInt = -128..127;
Description
The ShortInt type is the smallest form of signed integer, occupying 8 bits (1 byte) of storage.
 
It supports only the integers from -128 to 127.
Related commands
Byte An integer type supporting values 0 to 255
Cardinal The basic unsigned integer type
Int64 A 64 bit sized integer - the largest in Delphi
Integer The basic Integer type
LongInt An Integer whose size is guaranteed to be 32 bits
LongWord A 32 bit unsigned integer
SmallInt An Integer type supporting values from -32768 to 32767
Word An integer type supporting values 0 to 65535
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Showing the maximum and minimum values
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  min, max : ShortInt;
begin
  // Set the minimum and maximum values of this data type
  min := Low(ShortInt);
  max := High(ShortInt);
  ShowMessage('Min short int value = '+IntToStr(min));
  ShowMessage('Max short int value = '+IntToStr(max));
end;
 
end.
Hide full unit code
   Min short int value = -128
   Max short int value = 127
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page