how can i take the value of a vector 3 from a liste of vector 3 [closed]

foreach (Vector3 posit in position){
if (ang){

float a = Random.Range (0.0f, 60.0f);
//Vector3 p1= new Vector3((position[i-1].x)+(ra*cos(a)),0.0f,(position[i-1].z)+(ra*Sin(a)));

}
else
{
//Quaternion.Angle=60.0f;
float a = Random.Range (120.0f, 290.0f);

}
Vector3 p1 = new Vector3((posit[i-1].x)+(ra*(Mathf cos(a))), posit[i].y,(posit[i-1].z)+(ra*(Mathf Sin(a))));

ang=!ang;
//return(pos);
i++;
}

return(position[i]);


}

Instead of foreach, you'll want to use for.
for (int i = 0; i < position.Count; i++) {

This way, you'll be able to access the previous position using position[i-1].
Keep in mind, however, that this won't work if i == 0 because you can't go less than zero, so you'll want to add some checks to ensure i > 0 before using position[i-1].