I'm a beginner and i got the error CS0116. I tried everything but didn't work. Do you have any idea why it isn't working?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

const int maxIterations = 100;
const float minAcceptableDst = 0.01f;

public void Solve(Vector3[] points, Vector3 target)
{
    Vector3 origin = points[0];
    float[] segmentLenghts = new float[points.Lenght - 1];
    for (int i = 0; i < points.Lenght - 1; i++)
    {
        segmentLenghts _= (points[i + 1] - points*).magnitude;*_

}

for (int iteration = 0; iteration < maxIterations; iteration ++)
{
bool startingFromTarget = iteration % 2 == 0;
System.Array.Reverse(points);
System.Array.Reverse(segmentLenghts);
points[0] = (startingFromTarget) ? target : origin;

for (int i = 1; i < points.Length; i++)
{
Vector3 dir = (points - points[i - 1]).normalized;
points = points[i-1] + dir * segmentLenghts[i-1];
}

float dstToTarget = (points[points.Length - 1] - target).magnitude;
if (!startingFromTarget && dstToTarget <= minAcceptbleDst)
{
return;
}
}
}

CS0116 is not the error type… is the line of the code where the error is… line 116, it says alse the script name.

And the error will also say what is happening

Check again, try to solve by yourself, and if you cant, make another post, pastiong all error explanation, and where is the error in your code.

Good luck!