# ⤷ Get distance between 2 points

Use Distance function for detecting distance between 2 points.XPos and YPos are coordinates of the first point and X and Y are coordinates of the second point.

```
uses Math;
...
function Distance(XPos, YPos, X, Y: Real): Real;
begin
Result:=sqrt(
Power(XPos-X,2)+Power(YPos-Y,2));
end;
```

- More for developers