From: Jason Lillywhite [mailto:jason.lillywhite / gmail.com] # 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} you're indexing normally, why not use an array? > ar=Array.new(15){|x| 24+x*6} => [24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108] > ar[0] => 24 > ar[5] => 54 w added adv that you can refer in groups > ar[0..5] => [24, 30, 36, 42, 48, 54] no need to rush, you can convert to hash anytime ;) > hh=Hash[*ar.each_with_index.to_a.flatten] => {60=>6, 66=>7, 72=>8, 78=>9, 84=>10, 90=>11, 24=>0, 96=>12, 30=>1, 102=>13, 36=>2, 108=>14, 42=>3, 48=>4, 54=>5}