From: puzzled186@... Date: 2001-11-07T13:00:38+09:00 Subject: [ruby-talk:24480] Re: Range in Hash array? Thanks for the responses. Of course, I should have realized that the 1..100 is "just a single object". I'll play with either approach, not familiar with the fill method. Thanks On Tue, 06 Nov 2001 22:32:57 GMT, "Ryan" wrote: > >> > I'd like to be able to do something like: >> > {1..100=>"a",101..300=>"c", 500..1000=>"r"} > >Not sure if this does what you want, but it's a possibility: > >h=[] >h.fill('a', 1..100) >h.fill('c', 101..300) >h.fill('r', 500..1000) > >which would create an array of these elements, filled per >the range given. this would actually read exactly the same >way, i.e. h[5] == 'a' and h[301] == nil > >Ryan >