Computer Science Canada

What does += or *= mean?

Author:  dehu87 [ Tue May 27, 2008 1:01 pm ]
Post subject:  What does += or *= mean?

Im new to turing and i saw a program that included += this symbol. My question is
what does += or *= mean?

Author:  Dan [ Tue May 27, 2008 1:14 pm ]
Post subject:  RE:What does += or *= mean?

saying somthing like

x += 1

is equlent to saying

x = x +1


The same goes for the * operation. Simpley put it means add (for +=) or times (for *=) the varible on the left by the stamnet on the right and store it back in the varible on the left.

Author:  isaiahk9 [ Tue May 27, 2008 3:07 pm ]
Post subject:  RE:What does += or *= mean?

To be exact,

x += 1

is equivalent to saying

x := x + 1

Author:  Sean [ Tue May 27, 2008 3:28 pm ]
Post subject:  Re: What does += or *= mean?

That's identical to what Dan said.

Author:  Mackie [ Tue May 27, 2008 3:29 pm ]
Post subject:  RE:What does += or *= mean?

Not really. There is a colon that dan missed.

Author:  Tony [ Tue May 27, 2008 3:34 pm ]
Post subject:  RE:What does += or *= mean?

The colon was implied.

Generally speaking, = is the assignment operator, while == is the comparison for equality. So the difference is between pseudocode and Turing's syntax. Which in this case is negligible.

Author:  Dan [ Tue May 27, 2008 6:32 pm ]
Post subject:  RE:What does += or *= mean?

For more useless facts, saying x = x + 1 in turing is only a warning and will still run the code in most versions Wink, tho yes i was going for pseudocode.


: