type
TNumber = (Ace, One, Two, Three, Four, Five, Siz, Seven, Eight,
Nine, Ten, Jack, Queen, King);
TMyEnumeration = enum(First, Second,Third,Tenth=10,Eleventh);
TMyFlags = flags(Alpha,Beta,Gamma);
TMyExplicitEnum = (eeOne=1,eeTwo=3,eeFive=5);
procedure TForm1.W3Button12Click(Sender: TObject);
var
CourtCards: Set of TNumber; // Court cards
CardNumbers : array[1..4] of TNumber;
i : Integer;
begin
WriteLn(TMyEnumeration.First); // index 0
WriteLn(TMyEnumeration(1)); // index 1
WriteLn(TMyFlags.Beta); // index 2
WriteLn(TMyExplicitEnum.eeTwo); // index 3
// Set up the card numbers only to allow picture cards
CourtCards := [Ace, Jack, Queen, King];
// Define some cards
CardNumbers[1] := Ace;
CardNumbers[2] := Four;
CardNumbers[3] := Jack;
CardNumbers[4] := Seven;
// Show the picture cards that we have
for i := 1 to 4 do
if CardNumbers[i] in CourtCards
then ShowMessage('Card '+IntToStr(i)+' is a court card');
end;
|