How to add/subtract an amount to a variable? [solved]
F.x if I have Var1 and I want to either subtract with it Var2 or simply a fixed amount like 20, how would i write this?
Sorry if it's a very newb question, but I can't seem to find the answer in other posts or the help finder
edit: spelling fix
Var1 += 20 ; adds 20 to Var1 Var1 -= 20 ; subtracts 20 from Var1
You can do the same with another variable:
Var1 -= Var2 ; subtracts Var2 from Var1
But that can be a little confusing, so I would do something like this:
Var3 := (Var1 - Var2)
It's just a matter of preference.
Thanks so much stanman! When you are a non-programmer -- it is like the documentation is written in a foreign language sometimes. I get so confused! I've been trying to figure out what I've been doing wrong in my code all morning and thanks to you I finally get it!