7/13 Oops error


#1



#why with this code i get this error:
#Oops, try again. It looks like you aren't printing each
#colon-separated key-value pair on its own line. Check the hint if you need help!
secret_identities = {
  "The Batman" => "Bruce Wayne",
  "Superman" => "Clark Kent",
  "Wonder Woman" => "Diana Prince",
  "Freakazoid" => "Dexter Douglas"
}
  
secret_identities.each do | a, b | #i tried even with | superhero, name | and i get the same error
      puts  " #{ a } : #{ b }\n " # "\n" was a try, but i get this error with or without.
  end #  puts  "#{ a } : #{ b } " gives me same error 

########################################################################

#while this one works????
#i found this one forum


secret_identities = {
"The Batman" => "Bruce Wayne",
"Superman" => "Clark Kent",
"Wonder Woman" => "Diana Prince",
"Freakazoid" => "Dexter Douglas"
}
secret_identities.each do |superhero, real|
puts "#{superhero}: #{real}"
end

#thank you


#2

Hi, how can we help? What error are you receiving?


#3

the error is in the 2nd & 3rd line comment

Oops, try again. It looks like you aren't printing each

colon-separated key-value pair on its own line. Check the hint if you need help!

well, i would like to know why with my code, the part above the ##########, do not works,
while the second part, the one below the hashes works without any problem( i found that here one the forum)


#4

It could be that you've got a space between the key and the colon.


#5

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