type
TCars = (Ford, Vauxhall, GM, Nissan, Toyota, Honda);
procedure TForm1.W3Button2Click(Sender: TObject);
var
cars : array[TCars] of string; // Range is 0..5
japCars : array[Nissan..Honda] of string; // Range is 3..5
begin
// We must use the appropriate enumeration value to index our arrays:
japCars[Nissan] := 'Bluebird'; // Allowed
japCars[Toyota] := 'Galaxy'; // Allowed
// japCars[4] := 'Corolla'; // Not allowed
// japCars[Ford] := 'Galaxy'; // Not allowed
WriteLn(japCars[Nissan]);
WriteLn(japCars[Toyota]);
end;
|