Use each to loop through a hash : each « Hash « Ruby






Use each to loop through a hash


zip = { 2 => "A", 5 => "T", 3=> "h", 4 => "e", 8 => "T" }

zip.each {|k,v| puts "#{k}/#{v}" } # =>

 








Related examples in the same category

1.Iterating Through Hash Elements
2.Assign key and value pair to a string in hash each method
3.Loop hash with interpolation