📜  遍历哈希 ruby 代码示例中的每个键值

📅  最后修改于: 2022-03-11 15:04:45.695000             🧑  作者: Mango

代码示例1
restaurant_menu = { "Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2 }
restaurant_menu.each do | item, price |
  puts "#{item}: $#{price}"
end