Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Ruby :: ruby rails find data field type 
Ruby :: ruby class variable 
Ruby :: ruby while loop 
Ruby :: rails always 2 decimal 
Ruby :: ruby find max value in array 
Ruby :: grails 3 cron jobs 
Ruby :: generate dates using period rails 
Ruby :: how to update model rails 
Ruby :: how to upload a file in capybara spec 
Ruby :: ruby shorthand if 
Ruby :: generate view rails 
Ruby :: stripe test keys 
Ruby :: ruby remove nil element in array 
Ruby :: rails migration column types 
Ruby :: important topic on ruby 
Ruby :: ruby nth element of array 
Ruby :: ruby 3 one line method 
Ruby :: generate float array in ruby 
Ruby :: csv parse ruby 
Ruby :: how to group array in ruby 
Ruby :: rails print number with space 
Ruby :: rails list down attributes of model 
R :: r define nested empty list 
R :: if not i startswith r 
R :: r optim 
R :: types of vectors in r 
R :: r dataframe append row 
R :: drop na in r 
R :: R dplyr select 
R :: comment faire un boucle sur r 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =