you must assign the result of int.to_i - 1 to int. And you don't need the .to_i
So: int = int -1 (or int -= 1) should do what you want.