From: Jason Lillywhite Date: 2008-11-20T00:31:21+09:00 Subject: build hash by iterating I am building a hash this way: h = {} i = 0 j = 24 while i < 15 do h[i] = j i += 1 j += 6 end => {5=>54, 11=>90, 0=>24, 6=>60, 12=>96, 1=>30, 7=>66, 13=>102, 2=>36, 8=>72, 14=>108, 3=>42, 9=>78, 4=>48, 10=>84} Just what I need, but doesn't seem very Ruby-friendly And if I want to change each hash value from fixnum to string, how would that be done? this is not working: new_hash = h.each_key {|k| h[k].to_s} thank you! -- Posted via http://www.ruby-forum.com/.