How to find total distance from start to end of an array which stores positions in vector3?

If an array contains positions of a path then how to find total distance of the path

@shivanshsaini17 Use [Vector3.Distance][1] for finding distance between two points.
Use can try this code snippet:

public Transform []path;
float pathDistance;

void CalculatePathDistance()
{
    for (int i = 0; i < path.Length - 1; i++)
    {
        pathDistance += Vector3.Distance(path*.position, path[i + 1].position);*

}
}
[1]: Unity - Scripting API: Vector3.Distance

Off the top of my head, I would do something likeā€¦

float distanceTotal = 0;
int index = 1;
Transform startPosition = arrayPositions[0].transform;
foreach(position in arrayPositions)
{
    distanceTotal = (arrayPosition[index].transform.position + position);
    index += 1;
}
distanceTotal = distanceTotal - startPosiiton.position;

the exact coding, of course, would be more . . . thought out? but that should give you a starting point.