ID:173948
 
what's the difference between this two code?

usr.VARIABLE++

usr.VARIABLE1 += 1
usr.VARIABLE++

usr.VARIABLE1 += 1

These both have the same effect.
The wierdness of ++ comes in when you use it in a statement where precidence comes into play.

var/i = 1
world << "[++i]"
world << "[i]"

This should print
2
2

var/i = 1
world << "[i++]" // Note the ++ is after the i now
world << "[i]"

This should print
1
2


When you put ++ before a variable it has a high precidence so the variable is increment before many of the other things on the same line happin. If you put the ++ after the variable the variable is incremented much later so if you do something like

MyProc(i++)

MyProc is called with the initial value of i then after it is done it's incremented.

This causes many problems for C++ programmers and I'm sure it has caused it's fair share of confusion here too. Since you usually want the variable to be incremented earlier on it's best to get in the habbit of doing ++i instead of i++ since the latter can lead to some nasty problems if you don't catch it.
Just to add to Theodis's explanation, in DM you can use var++ as an expression whereas var+=1 is a statement. In C there's no distinction; everything is an expression. In DM, however, you can't do this:
DoSomething(i += 1)
But you can do this:
DoSomething(++i)
Note that i++ is not equivalent to i+=1, in C or any other language; in C, the value would be the new i, not the original i. That makes i+=1 the same as ++i. i++ returns the old value, but changes i right afterward.

Lummox JR