我在 Repl.it 上进行了哈希处理,我尝试了所有操作,但始终遇到相同的错误。
我对散列进行了更多研究,并且学到了很多东西。我14岁,我已经在ruby 2.5.5上遇到了一个主要问题。
这是我做的哈希
name_hash {15 => "Michael", 13 =>"Christopher",114 =>"Ryan"
预期结果是没有错误,但我只是返回此错误
(repl):9: syntax error, unexpected =>, expecting '}'
name_hash {15 => "Michael", 13 =>"Christopher...
^~
(repl):9: syntax error, unexpected ',', expecting end-of-input
name_hash {15 => "Michael", 13 =>"Christopher",114 =>"Ry...
答案 0 :(得分:1)
尝试一下:
name_hash = {15 => "Michael", 13 =>"Christopher",114 =>"Ryan"}