unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TMonth = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
const
TAbc: array[TMonth] of integer = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
//原来数组定义是不一定使用array[0..5] of integer.只要是有序类型就可以
{帮助上这样说的
Static array types are denoted by constructions of the form
array[indexType1, ..., indexTypen] of baseType;
where each indexType is an ordinal type whose range does not exceed 2GB. Since the indexTypes index the array, the number of elements an array can hold is limited by the product of the sizes of the indexTypes. In practice, indexTypes are usually integer subranges.
}
// TAbc: array[Boolean] of string = ('True', 'False');
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
i: integer;
begin
for i := 0 to 11 do
memo1.Lines.Add(inttostr(TAbc[TMonth(i)]));
end;
end.