+ 1

I didn't understand the difference between these function.What is the importance of (+=) ?Can anyone describe?

X=2 Print(X) Now X+=5 Print(X) Why should we write this instead of X=X+5

10th May 2021, 2:48 PM
Taslima Akter
Taslima Akter - avatar
2 Answers
+ 3
Simplified answer: there is a thing in the world called "shortcut". This is it. Another reason is, to increase the readability.
10th May 2021, 2:54 PM
Genuine Stalwart
Genuine Stalwart - avatar
+ 1
As long as I know += faster than the other syntax.
10th May 2021, 2:58 PM
Kashyap Kumar
Kashyap Kumar - avatar