MaxInt

Adam Boduch
MaxInt
Moduł: System
```delphi const MaxInt = High(Integer); ``` [[Delphi/Stałe|Stała]] zwraca największą możliwą wartość liczby typu [[Delphi/Integer]], czyli 2147483647. Przykład wykorzystania:
program Foo;

{$APPTYPE CONSOLE}

uses
  Math, SysUtils;

begin
  Writeln('Integer: ', MaxInt, ' -- ');
  Writeln('LongInt: ', MaxLongInt, ' -- ');
  Writeln('Comp: ', MaxComp, ' -- ', MinComp);
  Writeln('Double: ', MaxDouble, ' -- ', MinDouble);
  Writeln('Single: ', MaxSingle, ' -- ', MinSingle);
  Writeln('Extended: ', MaxExtended, ' -- ', MinExtended);
  Writeln('TDateTime: ', MaxDateTime, ' -- ', MinDateTime);
  Readln;
end.

Niestety w module System nie zadeklarowano stałej MinInt, minimalną możliwą wartość typu Integer możemy pobrać korzystając z funkcji Low: Low(Integer).

Zobacz też:

0 komentarzy