Ruby on rails ++;价值或价值++;在rails中(ruby)

Ruby on rails ++;价值或价值++;在rails中(ruby),ruby-on-rails,operators,Ruby On Rails,Operators,RubyonRails是否具有与++等价的值 在c语言中有一个++x和一个x++ 它们不是相同的操作(严格地说)。。 rails有相似的东西吗 c++ code int x = 0; if(x++) cout << "value is not zero when compared" else cout << "value still zero when compared" //prints "value still zero when compared" x

RubyonRails是否具有与++等价的值

在c语言中有一个++x和一个x++

它们不是相同的操作(严格地说)。。 rails有相似的东西吗

c++ code
int x = 0;
if(x++) cout << "value is not zero when compared"
else    cout << "value still zero when compared"
//prints   "value still zero when compared"

x = 0;
if(++x) cout << "value is not zero when compared"
else   cout << "value is still zero when compared"
//prints "value is not zero when compared"

不,它没有,但是它有
+=1

它看起来不像是有后期增量()。。让我伤心。。作为一名“语言律师”,其速度比公司慢得多。。但何时批准?在打印之前还是之后?如果重新计票是10,我用+=1调用上面的,那么打印什么?10或11?@daveatflow比不存在的运算符慢?inc存在。。在过去15年中制造的每个处理器上。我们热爱这种金属的人仍然能看到它。@daveatflow你是说
+=1
不能编译成
inc
?+=比x++慢得多,比x++慢得多。。但这并不是问题的关键。。我只是想看看操作的评估时间。
#print out the count of products processed, the current id, and the current name
p "#{recCount++}:#{product.id} #{product.name}";