Thank you MTF
Thank you. This is actually very logical.
I am relatively new to coding, but my theory is that it is simply a convenient short-hand way to express the value. Writing
x = x+1 gets old pretty quick. Over time it become quicker to write
x += 1. Once you get used to it, I also find it easier to read.
Under the hood, they are two different operations.
loved the quote, saving it. Although I would’ve appreciated if you gave a little peek into the real answer too
Is it because it’s easier to use this form?
The difference between
a = a + n and
a += n is primarily that the latter is an in place operation, meaning that while possible, the operation takes place in the same slot in memory; the former is a new assignment so will be in a different slot.
i think i get it now. thanks!
Well explained. Thank you