Const 定数定義
Delphiで定数を定義するには const節 に宣言します。
| ■ Const の使用例 |
procedure TForm1.Button1Click(Sender: TObject);
const
DELPHI = 'Borland Delphi'; // string
VERSION = 5; // integer
F : array [0..4] of string = ('XML','CORBA','COMPILER','OLAP','ACTIVEX');
begin
ShowMessage(DELPHI + IntToStr(VERSION) + #13#10 +
F[0] + F[1] + F[2] + F[3] + F[4]);
end;
|
constでは型は定義しません。
また、初期値の設定に=を記述することに注意して 下さい。代入の := ではありません。
関連項目
Dim 変数定義
Static 静的変数