From: Marnen Laibow-Koser Date: 2010-02-02T03:08:15+09:00 Subject: Re: Adding keys to a hash in a loop Jack Bauer wrote: > Marnen Laibow-Koser wrote: >> The same way you assign to a hash element outside a loop: >> output_hash[item.name] = value . << is only useful with arrays, not >> hashes. > > > Thanks, I know << is only for arrays. Using = will only end up with one > key and not all 10 that I'm trying to get. Wrong. Do it inside the loop, for each key in turn. Try it! Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.