+ 1
What i = i + 1 does in this code?
I can't really get what i = i + 1 does here.
6 odpowiedzi
+ 7
another way of writing this is:
i += 1
also you can use another operators instead of "+".
for example:
i = 2
i *= 3
now i is 6.
+ 4
This is absolutely great for scores in games--it takes a variable and adds the number 1 (or any number you'd like) to it. Also, in some languages this is abbreviated to be i++, like C++ does.
+ 3
for example
i = 1
i = i + 1
i is 2 now
so its just increase i :)
+ 3
It increases the value if I every time it executes.
+ 2
Thank you!
0
i is assigned the value of itself and then adds 1 to that value and assigns that new value to i