Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

I'm working through problem set 1 and have a question about some of the comparison terms. What does += and -= mean? everything else in the solution file makes sense to me but I'm struggling with understanding these terms.

OpenStudy (anonymous):

can you show the text of the actual problem please?

OpenStudy (anonymous):

also what language is this java, c, c++ ?

OpenStudy (anonymous):

in C/C++/java check the following page - scroll down to the section on "Assignment Operators" http://www.tutorialspoint.com/cprogramming/c_operators.htm Here is an excerpt: += means "Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand" example: C += A is equivalent to C = C + A and -= means "Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand: example: C -= A is equivalent to C = C - A There are also other combinations with = like *=, /=, ...

OpenStudy (rsmith6559):

Python supports these "shorthand" notations. a += b is shorthand for a = a + b. Subtraction, division and multiplication are also supported.

OpenStudy (anonymous):

a+=b means a=a+b a*=b means a=a*b a/=b means a=a/b a-=b means a=a-b a=+b is very different from a+=b so be careful with these typing errors that can lead to very annoying problems.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!