On 19/06/15 08:46, Torsten Bonde Christiansen wrote:
> program Project1;
>
> type
>   TMyEnum = (
>     a = 1,
>     b = 3,
>     c = 5
>   );
>   TMySet = set of TMyEnum;
> var
>   Item: TMyEnum;
>
> begin
>   for Item in TMySet do
>     Writeln('Value = ', Integer(Item));
> end.

My guess is that you are iterating a set type, that is wide enough to
hold all 5 values.
Iterating a set var produces the expected output.

program Project1;

type
  TMyEnum = (
    a = 1,
    b = 3,
    c = 5
  );
  TMySet = set of TMyEnum;
var
  Item: TMyEnum;
  MySet : TMySet = [a,b,c];

begin
  for Item in MySet do
    Writeln('Value = ', Integer(Item));
end.


Still, I can see your point.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to