+ 2

What does total+= do?

9th Jul 2016, 10:37 PM
Clarence
11 ответов
+ 4
it simply means total = total + do for example if your total = 0 and do = 10 and if you use this total + = do that is same as total = total + do then your answer comes out to be 10
16th Jul 2016, 4:45 AM
Karan Luther
Karan Luther - avatar
+ 2
total+=do is similar to total = total + do
10th Jul 2016, 9:55 AM
Praneethkumar Sajalu
Praneethkumar Sajalu - avatar
+ 1
You can look it up under: basic concepts\basic arithmetric (9).
9th Jul 2016, 11:09 PM
Tobias B.
Tobias B. - avatar
+ 1
Thanks alot
9th Jul 2016, 11:10 PM
Clarence
+ 1
please upvote useful comments, thanks
9th Jul 2016, 11:17 PM
Tobias B.
Tobias B. - avatar
+ 1
It adds itself a value. ex: totalValue += 8 the same as: totalValue = totalValue + 8
10th Jul 2016, 1:43 AM
Ángel Molina
Ángel Molina - avatar
+ 1
total += do means total=total + do
10th Jul 2016, 3:22 AM
piyush
+ 1
Its just a faster way to do "total = total + (whatever you decide)". There are a lot of shortcuts like this mostly to make coding faster as you have to type less. It also looks less complicated cleaning up the look of your code and making it less messy looking.
15th Jul 2016, 7:23 PM
Adam
0
it's simply means that total integer + do integer
13th Jul 2016, 4:44 PM
Akshay
0
its a combination of two operator. a + and a = . + has higher priority so first two operands are added and then the result is being set as the new value for the first operand.. those guys who created C did it too make it look cool but just cuased more confusion. total+= x; sums the values of total and x and after that sets total equal to that sum.
7th Nov 2016, 9:16 PM
h.k
0
simply total = total + do
16th Nov 2016, 9:41 AM
Akshay