ruby - 我不断收到与我的哈希有关的错误
问题描述
我在Repl.it上做了一个哈希,我已经尝试了所有方法,但我一直收到同样的错误。
我对哈希进行了更多研究,并且学到了很多东西。我十四岁,我已经在 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...
解决方案
尝试这个:
name_hash = {15 => "Michael", 13 =>"Christopher",114 =>"Ryan"}
推荐阅读
- pyspark - Pyspark 以递减的方式填充缺失值
- python - Python - 将 for 循环变成单线
- reactjs - 当我运行 npm intall firebase 时出现此错误,我该如何解决
- css - 如何更改 Facebook Messenger 网站插件的 Z-index
- reactjs - 条形图不显示
- sql - 我想对日期时间列有不同的结果
- mysql - 无法在 drupal 8 中安装任何模块
- python - /update_item/ 'WSGIRequest' 对象的 AttributeError 没有属性 'data'
- swiftui - 为什么文本在加载动画时出现?
- spring - 我可以自动连接 Spring Cloud 中的所有可用频道吗?