13. Help witht "Iterating Over Hashes"


#1

May someone help me with this please ?
I don't understand the error message on this ...

identites_secretes = {
  "The Batman" => "Bruce Wayne",
  "Superman" => "Clark Kent",
  "Wonder Woman" => "Diana Prince",
  "Freakazoid" => "Dexter Douglas"
}

identites_secretes.each do |superhero, real name|
    puts "#{superhero}: #{real name}"
end

And this is the answer I have:

(ruby):7: syntax error, unexpected tIDENTIFIER, expecting '|'
identites_secretes.each do |superhero, real name|
                                                ^
(ruby):8: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
    puts "#{superhero}: #{real name}"
          ^
(ruby):9: syntax error, unexpected keyword_end, expecting $end

Thanks !

`


#2

unexpected tIDENTIFIER, expecting '|'

To the interpreter, this looks like two variables, not one.


#3

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