What does += or *= mean?
Author |
Message |
dehu87
|
Posted: 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? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dan
|
Posted: 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. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
isaiahk9
|
Posted: 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 |
|
|
|
|
|
Sean
|
Posted: Tue May 27, 2008 3:28 pm Post subject: Re: What does += or *= mean? |
|
|
That's identical to what Dan said. |
|
|
|
|
|
Mackie
|
Posted: Tue May 27, 2008 3:29 pm Post subject: RE:What does += or *= mean? |
|
|
Not really. There is a colon that dan missed. |
|
|
|
|
|
Tony
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Dan
|
Posted: 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 , tho yes i was going for pseudocode. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
|
|