x += 2 or x =+ 2 - difference | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

x += 2 or x =+ 2 - difference

What is difference between those 2 statements: x += 2 x =+ 2 How they acts in loops, etc ?

14th Jun 2017, 8:52 AM
Paweł W.
Paweł W. - avatar
3 Answers
+ 4
Never mind, I googled it. This is the answer: x += 3 - this is equation x = x + 3 x =+ 3 - this is declaration like x = +3 (meaning x is 3 and its positive value)
14th Jun 2017, 9:04 AM
Paweł W.
Paweł W. - avatar
+ 4
:) Should probably give Sudarshan best answer anyway since they went to the effort
14th Jun 2017, 9:06 AM
jay
jay - avatar
+ 3
In x +=2, variable x gets value x = x+2. And in x=+2, it just assigns value 2 to X.
14th Jun 2017, 9:05 AM
Sudarshan Mise
Sudarshan Mise - avatar