What does it mean sum += arr[x] ; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does it mean sum += arr[x] ;

I mean +=

21st Oct 2016, 5:57 AM
B Shardiya
6 Answers
+ 8
it means sum=sum+arr[x] it adds the value of arr[x] to the variable sum
21st Oct 2016, 7:15 AM
marcram
+ 5
It means sum=sum+arr[x] ; Most commonly used example is i+=1; Which also means i=i+1;
22nd Oct 2016, 9:09 AM
Mayank Garg
Mayank Garg - avatar
0
you are asking +=,it's mean eg., a+=b a=1,b=2:a can add with b..output:3;it simplify and flexible..
3rd Jan 2017, 3:24 PM
dinesh s
dinesh s - avatar
0
Simply put, it (+=) is a dual operator. And it means that first you 'add' then you 'assign'. Eg; "b += a" means -> b == [b = (b+a)].
6th Jan 2017, 10:11 AM
X3KE DAITENSHI
X3KE DAITENSHI - avatar
0
my frien who asking this question the simple means of sum+=arr[x]; is this sum = sum+arr[x];
4th Dec 2019, 6:55 AM
akash singh
akash singh - avatar
0
OMG!!! I have been wrecking my brain on this one for a while and its always been something this obvious!?! 🤯🤯🤯🤯🤯🤯🤯🤯
15th Mar 2022, 11:52 AM
Sebi Poiana
Sebi Poiana - avatar