If I go
variable1 =+ variable2
variable1 += variable2
I get the same result for variable1.
So is there any difference?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The difference is that your observation is not correct and
variable1 =+ variable2does not add variable2 to variable1, but rather sets variable1 equal to variable2. The line is reallyvariable1 = +variable2, or simplyvariable1 = variable2.Consider this code
At the end of this process,
aequals 40. It is intialized to 10,bis initialized to 20,ais set equal tob, and thenbgets added toa.