Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

iterate over each key value in hash ruby

restaurant_menu = { "Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2 }
restaurant_menu.each do | item, price |
  puts "#{item}: $#{price}"
end
 
PREVIOUS NEXT
Tagged: #iterate #key #hash #ruby
ADD COMMENT
Topic
Name
5+6 =