From: Matthew Kerwin Date: 2012-05-29T20:38:07+09:00 Subject: Re: how to create 'numbered symbols' in iterator? Since a symbol is just an interned string you can use "key#{i}".intern (or .to_sym) to cast it to a symbol. On 29 May 2012 21:28, rooby shoez wrote: > I had this > >        { >        key0: OpenSSL::Digest::SHA256.new.digest("1 #{key}"), >      key1: OpenSSL::Digest::SHA256.new.digest("2 #{key}"), >      key2: OpenSSL::Digest::SHA256.new.digest("3 #{key}"), >      key3: OpenSSL::Digest::SHA256.new.digest("4 #{key}") >      } > > I want this > > subkeys = {} > 4.times do |i| > subkeys[:key"#{i}"] = OpenSSL::Digest::SHA256.new.digest("#{i} #{key}") > end > > -- > Posted via http://www.ruby-forum.com/. > --   Matthew Kerwin, B.Sc (CompSci) (Hons)   http://matthew.kerwin.net.au/   ABN: 59-013-727-651   "You'll never find a programming language that frees   you from the burden of clarifying your ideas." - xkcd