Computer Science Canada Kind of Stupid Question (+=,-=) |
Author: | Mr.Programmer [ Wed Feb 27, 2008 7:15 pm ] |
Post subject: | Kind of Stupid Question (+=,-=) |
My question is, what do these two things mean: ' += ' and ' -="? I know that := means 'becomes', but these two i cant figure out. Here's an example: vely -= GRAVITY posx += round (velx) posy += round (vely) Thanks! |
Author: | Tony [ Wed Feb 27, 2008 7:24 pm ] |
Post subject: | RE:Kind of Stupid Question (+=,-=) |
var += 42 is the short way of saying var := var + 42 |
Author: | Mr.Programmer [ Wed Feb 27, 2008 7:26 pm ] |
Post subject: | Re: Kind of Stupid Question (+=,-=) |
Ohhh. Then i guess var -= 22 is like saying ' var :+ var - 22 '? If so then it makes sense. And thank you very much. |
Author: | Bored [ Thu Feb 28, 2008 7:26 pm ] |
Post subject: | Re: Kind of Stupid Question (+=,-=) |
There's also other including *=, /=, div=, and I beleive there might be more that I'm missing. |
Author: | BigBear [ Thu Feb 28, 2008 7:34 pm ] | ||||
Post subject: | Re: Kind of Stupid Question (+=,-=) | ||||
when you use := it means becomes or is therefore equal to and when you use += it means becomes itself plus whatever is next
-= means becomes itself - something
You were a little confused when you said Mr.Programmer wrote: Ohhh. Then i guess var -= 22 is like saying ' var + var - 22 '? If so then it makes sense. And thank you very much. |
Author: | Clayton [ Thu Feb 28, 2008 9:33 pm ] |
Post subject: | RE:Kind of Stupid Question (+=,-=) |
I very much believe the :+ was a typo. |