>From: "Lyle Johnson" <ljohnson / resgen.com> >Subject: [ruby-talk:8642] Any way to get enumerated values? > I checked the FAQ but didn't see this one addressed. Is there any automatic > way to assign a range of integer values to a set of names, like "enum" > values in C/C++? The current approach I've taken, which isn't pretty, is > just: > > ID_FIRST_VALUE = 0 > ID_SECOND_VALUE = ID_FIRST_VALUE + 1 > ID_THIRD_VALUE = ID_SECOND_VALUE + 1 > ... etc. ... How about this?: A,B,C,D,E = (0..4).to_a Regards, M.Tanaka