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

How does += work?

18th Oct 2016, 7:49 PM
Shaffaf Rasheed
Shaffaf Rasheed - avatar
4 Answers
+ 1
it is same as increment operator
21st Oct 2016, 6:33 PM
Sanjeev Kr
Sanjeev Kr - avatar
+ 11
foo += var is the same as foo = foo + var
18th Oct 2016, 8:13 PM
Preston
Preston - avatar
+ 9
x+=5 is the same as x=x+5
22nd Oct 2016, 1:17 PM
Remmae
Remmae - avatar
0
if you want to add a value to the variable itself . that is int a=5; a+=5 makes the value of a to 10
20th Oct 2016, 6:02 PM
Rafeek Kunhikandy
Rafeek Kunhikandy - avatar