My background in C++ and Java has instilled in me some programming habits that don't play nice in Ruby. When I want to increment or decrement a number, my fingers instinctively go to '++' and '−−'.
Unfortunately, this syntax is not supported by Ruby. As a language design choice, Ruby opted to not support this syntactic sugar to increment/decrement a variable.
I will have to break my habit and start going with:
// increment x x+=1 // decrement x x-=1Another thing to note is that the prefix increment/decrement operators like '−−x' or '++x' do nothing. The signs are interpreted as unary operators.