java - Saving previous value for later usage -


i want save value , use later calculate difference between prog , progalt.

int prog = (s3.getprogress()-90); int progold = 0; int = prog-progold; 

then stuff happening. , after want save value of actual prog in progalt use in next round.

progold= prog; 

logically "progalt = prog" useless, because progalt set 0. so, how initialize progalt once , use saved value?

int prevvalue = 0; while (somecondition) {     int curvalue = ...;     int deltavalue = curvalue - prevvalue;     ...     prevvalue = curvalue; } 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -