
-----------------------------------
the_short1
Mon Feb 23, 2004 10:57 pm

can someone tell me the use of += and -= operators (SOLVED)
-----------------------------------
ive seen this in some programs but i do not know how/what it does exactly.... ive looked in turing help under operators... and i searched but no luck in finding it...

-----------------------------------
Paul
Mon Feb 23, 2004 11:00 pm


-----------------------------------
hehe...
+= is the same as something:=something + something else
-= is the same as something:=something - something else
so

number:=number+1
%is the same as%
number+=1

number:=number-1
%is the same as%
number-=1


-----------------------------------
the_short1
Tue Feb 24, 2004 7:52 am


-----------------------------------
that was my first guess.... but i wanted to knwo for sure...(also if it has more uses...)

cool... that little things shaves off lots of code...


Thanks,..   (Feeling Like a Noob)  :shock:  :(

-----------------------------------
naoki
Tue Feb 24, 2004 5:46 pm


-----------------------------------
mebbe it's only in C++ but you could also try

*= and
/= 
and see if they work as well

-----------------------------------
apomb
Tue Feb 24, 2004 8:09 pm


-----------------------------------
actually in turing , it works quite well ... i was initially going to reply that even (+=) doesn't work .. but i would have made quite a fool of myself , wouldn't i!? any way ... it works

-----------------------------------
jonos
Tue Feb 24, 2004 9:00 pm


-----------------------------------
yeah, cervantes uses that a lot and i never understood his code until i understood that. anyways, i wish turing allowed var++ or ++var cause that is SOOOOOO easy. hehe, anyways, everyone go and check out "shadows collide with people" by john frusciante
