If you use i++, the old value will be used for the calculation, and the value iwill be increased by 1 after.
In the case, the i = i + 1opposite takes place: first it will be increased, and only then will the calculation be performed.
If you want to have the behavior of the second case with a multiplicity of the first, use ++i: in this case i, it will first be increased to calculation.
, docs Assignment, Arithmetic Unary Operators!