Hi,

--- In [email protected], Jonathan Mora <[EMAIL PROTECTED]> wrote:
> Hmmm... wondering if you really tested your code...
> doing a for loop is not the same as the foreach
> construct (which is for collections). enumerated types
> are actually integers and you can typecast back and
> forth. so "for i := Low(TyourEnum) to High(TyourEnum)
> do" will actually convert to "for i := 5 to 25 do"
> 
> 
[snip]

   I tried this code:

function Test : integer;
type
  TMyType = (enum1, enum2, enum3);
var
  i : TMyType;
begin
  Result := 0;
  for i := Low(TMyType) to High(TMyType) do
    Inc(Result)
end;

   ... and it returns a result of 3, which is as I'd expect.

   If I try to change the declaration of TMyType to:

type
  TMyType = (enum1=5, enum2, enum3);

   ... then it won't compile. I'm using Delphi 5.

   ... also all of the Delphi help suggests that the above line is not
 valid code.

Regards,
     Peter W. :-)))
Sandy Bay, Hobart, Tas, AU.






-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to