What does variable += variable do | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does variable += variable do

what is the difference between (int x += int y) and (int x + int y).

25th Oct 2016, 5:22 PM
Sergio Romero
1 Answer
+ 5
a+=b is equivalent to a=a+b It will calculate sum of a and b and store it in a. Example: a=4,b=2; a+=b; means a=4+2 so a=6
25th Oct 2016, 5:31 PM
Sumita Das
Sumita Das - avatar