Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 What does += or *= mean?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
dehu87




PostPosted: 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
Sponsor
sponsor
Dan




PostPosted: 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




PostPosted: 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




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

That's identical to what Dan said.
Mackie




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

Not really. There is a colon that dan missed.
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dan




PostPosted: 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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: