Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; Procedure submit (Sender: tobject ); end; var form1: tform1; implementation {$ R *. DFM} // use byte, word, and Boolean to mark the array procedure tform1.button1click (Sender: tobject); var arr1: array [byte] of integer; arr2: array [word] of integer; arr3: array [Boolean] of integer; begin showmessage (inttostr (length (arr1); {256} arr1 [low (arr1)]: = 11; arr1 [high (arr1)]: = 22; showmessagefmt ('% d, % d', [arr1 [0], arr1 [255]); {11, 22} showmessage (inttostr (length (arr2); {65536} arr2 [0]: = 33; arr2 [65535]: = 44; showmessagefmt ('% d, % d', [arr2 [low (arr2)], arr2 [high (arr2)]); {33, 44} showmessage (inttostr (length (arr3 ))); {2} arr3 [false]: = 55; arr3 [True]: = 66; showmessagefmt ('% d, % d', [arr3 [low (arr3)], arr3 [high (arr3)]); {55, 66} end; // use "subinterface" to mark the array procedure tform1.button2click (Sender: tobject ); type TC = 'A '.. 'Z'; var arr: array [TC] of integer; N1, N2, N3: integer; begin showmessage (inttostr (length (ARR ))); {26} arr ['a']: = 11; arr ['B']: = 22; arr ['Z']: = 33; N1: = arr [CHR (97)]; N2: = arr ['abc' [2]; N3: = arr ['Z']; showmessagefmt ('% d, % d, % d', [N1, N2, N3]); {11,22, 33} end; // use "enumeration" to mark the array procedure tform1.button3click (Sender: tobject ); type tmyenum = (a, B, c, d); var arr: array [tmyenum] of integer; I: integer; begin arr [A]: = 11; arr [B]: = 22; arr [c]: = 33; arr [d]: = 44; for I in arr do showmessage (inttostr (I )); {11/22/33/44} end; // use the "enumeration" to mark the array procedure tform1.button4click (Sender: tobject); Type tmyenum = (x = 1, y = 3, z = 5); var arr: array [tmyenum] of integer; I, N1, N2, N3: integer; begin arr [x]: = 11; arr [y]: = 22; arr [Z]: = 33; I: = 1; N1: = arr [tmyenum (I)]; I: = 3; N2: = arr [tmyenum (I)]; I: = 5; N3: = arr [tmyenum (I)]; showmessagefmt ('% d, % d, % d ', [N1, N2, N3]); {11,22, 33} end; end.