I thought that i-- is a shorthand for i = i - 1, but I discovered that both evaluate different:
i--
i = i - 1
You should use --ias the pre-decrement operator.
--i
See the docs here