How to detect an update/change of a number?

How could a value be stored and be compared with an new value afterwards? Since I need an " autonomous" workflow for the optimization