Variable value in time.

I have got a float variable which is called “distance”. Its value changes along by time. I want compare his current value with his past value (0.1 secconds) because I want to know if this value increases or decreases along by time. ¿Any idea?

Excuse me for my english.

You could try printing the value of this variable before updating, then printing again after updating its value.

How can I set the variable value before updating?

And Thanks!!

Could you please show me when you change the “distance” variable value, in your code?

Thanks. I resolve this problem with timeline. I create a loop that actualize the variable value every 0.01 seconds. And compare current value and last value. But very thanks form your answer!!