How to save a constant updating value

I also recommend that you adopt the coding style of putting each { and } on separate lines with matching pairs indented by the same amount,

My 1 cent is hit CTRL-T in the IDE so it nicely formats your code, then copy-paste it here. Other people's code is hard enough to read, misindented code, although syntactically correct, makes the job unnecessarily harder.

Peace :slight_smile: