I have found myself wanting to do certain things in my programs only if a variable has changed. I have so far been doing something like this:
int x = 1; in
Example:
create a variable with the same name with a number.
int var1; int var2; if(var1 != var2) { //do the code here var2 = var1; }
hope this help.