ruby 语法错误,意外的 ',',期待 ')'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8541733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 04:35:52  来源:igfitidea点击:

syntax error, unexpected ',', expecting ')'

rubysyntax-errorruby-1.9

提问by dt1000

I just installed Ruby 1.9.2 after having used 1.8.7, as there is a feature I need. I had called many of my methods like this:

我在使用 1.8.7 后刚刚安装了 Ruby 1.9.2,因为我需要一个功能。我曾这样调用我的许多方法:

do_something (arg0, arg1)

With 1.9.2, i get the following error, syntax error, unexpected ',', expecting ')'and the fix seems to be:

使用 1.9.2,我收到以下错误, syntax error, unexpected ',', expecting ')'修复方法似乎是:

do_something arg0, arg1

But this could take me hours to fix all the cases. Is there a way around this? Why is it an error in the first place? thanks

但这可能需要我几个小时才能修复所有案例。有没有解决的办法?为什么它首先是一个错误?谢谢

回答by Pawe? Obrok

The extra space is the culprit. Use:

额外的空间是罪魁祸首。用:

do_something(arg0, arg1)