I was just experimenting with creating a hash and then interating over it and I keep getting an error



It keeps saying that it was expecting an ''end" after China and I don't know why.
There is another hash and iteration of that hash on top of this one. Is that why?

This is my code:

world_leaders = {
    "Barack Obama" => "United States"
    "Xi Jin Ping" => "China"
    "Shinzo Abe" => "Japan"
    "Vladimir Putin" => "Russia"

world_leaders.each do |country, leader|
    puts "#{country}: #{leader}"


The world_leaders object

  • has 4 properties
    • each consisting of a property-key and its associated Value
    • and the properties should be separated from eah other by a comma-,

world_leaders = {
    "Barack Obama" => "United States",
    "Xi Jin Ping" => "China",
    "Shinzo Abe" => "Japan",
    "Vladimir Putin" => "Russia"



Oh, yeah. Thanks!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.