foreach with enum

Vladimir Panteleev thecybershadow at gmail.com
Thu Jul 19 14:05:30 PDT 2007


On Thu, 19 Jul 2007 23:14:59 +0300, Thomas Mader <thezema at gmail.com> wrote:

> I am just porting some of my little Java programs to D to get comfortable with the langugage and realized that I cannot use foreach with Enums.
> In Java I can do:
> enum Color { Kreuz, Pik, Herz, Karo }
> for(Color color : Color.values()) {}
>
> AFAIK thats not possible in D yet.

for (Color color=Color.min; color<=Color.max; color++)
	writefln(color);

-- 
Best regards,
  Vladimir                          mailto:thecybershadow at gmail.com



More information about the Digitalmars-d mailing list