Could any one can explain what is the meaning of the line .... "total+=x" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could any one can explain what is the meaning of the line .... "total+=x"

29th Aug 2018, 6:30 PM
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA - avatar
6 Answers
+ 1
total+=x is same as adding value of x in total and then storing the final value in total variable i.e total = total + x;
1st Sep 2018, 8:19 AM
Afraz Aslam
Afraz Aslam - avatar
+ 9
total+=x; is shortened form of total =total+x;
29th Aug 2018, 6:36 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
Those are called Assignment Operators. a += b is equivalent to a = a + b a -= b is equivalent to a = a - b a *= b is equivalent to a = a * b a /= b is equivalent to a = a / b
29th Aug 2018, 6:57 PM
Alex
0
in that line first which operation is going to operate ?
29th Aug 2018, 6:38 PM
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA - avatar
0
+= according to bodmas ?
29th Aug 2018, 6:38 PM
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA - avatar
0
tq
30th Aug 2018, 1:47 AM
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA - avatar