What happens in the coding where we write total+=number and why we write num and number which is same i guess. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What happens in the coding where we write total+=number and why we write num and number which is same i guess.

also tell me how it is working here i didn't get it

4th Apr 2017, 6:44 PM
Anurag Janghala
Anurag Janghala - avatar
2 Answers
+ 6
x+=y means x=x+y num and number are variable,could be named ANYTHING,if they follow a proper criteria.
4th Apr 2017, 6:49 PM
Meharban Singh
Meharban Singh - avatar
+ 3
"num" and "number" are not the same. They are two different variables. total += number means that you are adding the value of "number" to the value of "total".
5th Apr 2017, 2:00 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar