Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby hash loop

hash = {"a"=>{:b=>"value", :c=>111}}

h.each do |key, value|
  puts key
  value.each do |k,v|
    puts k
    puts v
  end
end

Or:

h.each do |key, value|
  puts key
  puts value[:link]
  puts value[:size]
end

Or:

h.each do |key, value|
  puts key
  value.values.each do |v|
    puts v
  end
end
 
PREVIOUS NEXT
Tagged: #ruby #hash #loop
ADD COMMENT
Topic
Name
5+1 =