type
TmyEnumType=(myEnumTypeA=5,myEnumTypeB=2,myEnumTypeC=9); // (9 - 2)+ 1 = 8 elements
const
myEnumTypeOrder:Array[1..3] of TmyEnumType=(myEnumTypeA,myEnumTypeB,myEnumTypeC);
procedure TForm1.W3Button6Click(Sender: TObject);
var
myEnumTypeVariable:TmyEnumType;
begin
for myEnumTypeVariable in myEnumTypeOrder do
begin
// This code shows three messages in this secuence: 5, 2, 9
WriteLn(IntToStr(Ord(myEnumTypeVariable))); // Sample code to show enum integer value
end;
WriteLn(sLineBreak);
for myEnumTypeVariable:=Low(TmyEnumType) to High(TmyEnumType) do
begin
// This code shows eight messages in this secuence: 2, 3, 4, 5, 6, 7, 8, 9
WriteLn(IntToStr(Ord(myEnumTypeVariable))); // Sample code to show enum integer value
end;
end;
|