Store calculated distance in a variable