[定数]

◆定数の宣言

 constキーワードで定数を宣言します。
 書式は「const 定数名 =値;」,「const 定数名:型 =値;」となります。

 定数を宣言している例です。
const MaxValue = 255;

const MaxV = Int64(256);
const Achar = Byte($41);

const Pi:Extended = 3.1415926535898;
const MaxLength:Integer = 255;

const str = '文字列リテラル';

const WeekName  : array [0..6] of string  = ('日','月','火','水','木','金','土'); 

const Number : array [0..9] of Char = ('0','1','2','3','4','5','6','7','8','9'); 
const Number : array [0..9] of Char = '0123456789'; 

const 
 bytesize: Integer = SizeOf(Byte);
 a: Integer = Ord('a');
 x: Integer = Round(128.5678);
◆リテラル

 定数に対して、明示的にその型を示したい時期があります。
 そのような場合は、リテラルを用います。

ShortintShortint(123)
SmallintSmallint(123)
LongintLongint(123)
Int64Int64(123)
ByteByte(123)
Wordword(123)
LongwordLongword(123)
Char'a'
string'abcd'
TDateTimeStrToDateTime('2009/06/29')