added simple distance example with for loops