本文整理自网络,侵删。
数组与子界
type
TABC = 'A'..'G'; {定义子界}
var
abcArr: array[TABC] of Integer; {定义数组}
abc: TABC; {定义子界变量}
begin
{数组赋值}
abcArr['A'] := 11;
abcArr['B'] := 22;
abcArr['C'] := 33;
abcArr['D'] := 44;
abcArr['E'] := 55;
abcArr['F'] := 66;
abcArr['G'] := 77;
{调用数组}
ShowMessage(IntToStr(abcArr['G'])); {77}
{遍历数组}
for abc := Low(abcArr) to High(abcArr) do
begin
ShowMessage(IntToStr(abcArr[abc])); {11 22 33 44 55 66 77}
end;
end;
相关阅读 >>
Delphi 双击listbox1内容,数据插入到memo1/synedit1鼠标指定位置
Delphi xe 获取 android application version 版本
更多相关阅读请进入《Delphi》频道 >>