INSTRUCTING ARDUINO TO RECALL A PREVIOUSLY GIVEN VALUE

How do I make it visible to the second function (obviously without simply making it a global variable, since the distance will need to be updated as the programs runs).

Why would making it global prevent it from being updated?