0
What is the difference between "i =i+1" and "i +=i?
3 Réponses
+ 10
there is a big diffrence
i=i+1 means i equals the current value of i and then increments it by 1 so the value of i if it's current value is 10 would now equal the value of 11.
i+=i means the i now adds its current value to its self so let's say i equals 10 using this += expression the value of i will now equal 20 because you just added 10 to its self.
i+=1 does the same as i=i+1 there both incrementing the current value of i by 1.
0
Do you mean "i += 1"?
If so, then there's no difference.
0
Then i+=i means