Can anyone explain these two figure( +=, -=)


#1

What are these two symbols stand for( +=, -=)
and how to place it, can anyone give me an example and illustrate it, tks


#2

They are called 'operators' just as any other of their type. However, they are compound operators in that they perform two operations at once. The value is applied to the expression and the reassigned back on to the same variable.

a += b

is the same as writing,

a = a + b

Clearly the former is more programmatic, hence its ready adoption.


#3

thanks for your illustration~~