我想我只是习惯于说些类似的话:
x++
在PHP和Java领域。但是,当我在Rails代码中尝试此操作时,它很合适:
compile error
/users/gshankar/projects/naplan/app/views/answers/new.html.haml:19: syntax error, unexpected ';'
/users/gshankar/projects/naplan/app/views/answers/new.html.haml:23: syntax error, unexpected kENSURE, expecting kEND
...}\n", 0, false);_erbout;ensure;@haml_buffer = @haml_buffer.u...
^
/users/gshankar/projects/naplan/app/views/answers/new.html.haml:26: syntax error, unexpected $end, expecting kEND
我在Ruby/Rails运算符上搜索了一下,以获取对++的引用,但找不到任何内容。对于专注于减少写作的语言,我发现不会有++等效语言有些奇怪。我想念什么吗?
最佳答案
试试这个:
x += 1
关于ruby-on-rails - Ruby/Rails是否具有++等效项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2322875/