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

Username:   Password: 
 RegisterRegister   
 += and -=
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raknarg




PostPosted: Sun Mar 27, 2011 2:41 pm   Post subject: += and -=

Just a quick question about the language...
I've come across people using += and -= in their programs. I couldn't find any answers online or on the site, so could anyone tell me what it does?
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Sun Mar 27, 2011 2:48 pm   Post subject: RE:+= and -=

Those are accumulate operators. They say "add everything on the right to the variable on the left".

The statement x += 5 is equivalent to x = x + 5.
Raknarg




PostPosted: Sun Mar 27, 2011 3:09 pm   Post subject: RE:+= and -=

Oh. How convienient.
Oh, and one more: ~=
Insectoid




PostPosted: Sun Mar 27, 2011 3:23 pm   Post subject: RE:+= and -=

in Turing that represents 'not equal to'. It's the same as writing 'not='. Most other languages use ! as the not operator.
Raknarg




PostPosted: Sun Mar 27, 2011 3:54 pm   Post subject: RE:+= and -=

k thanks
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  [ 5 Posts ]
Jump to:   


Style:  
Search: