Hi because I get an error like this.....help

the error is this BCE0004:Ambiguous reference ‘Abs’: UnityEngine.Math.Abs(int), Unity.Engine.Mathf.Abs(float)

I leave the code

function signedSqrt(x){
   var r = Mathf.Sqrt(Mathf.Abs(x));
   if( x < 0 ){
      return -r;
   } else {
      return r;
   }
}

Its likely because you do not have a type for your X parameter, so it doesn’t know which mathematical Abs to use. Try this:

function signedSqrt(x:float):float{
   var r:float = Mathf.Sqrt(Mathf.Abs(x));
   if( x < 0 ){
      return -r;
   } else {
      return r;
   }
}

In general, untyped code is bad.

Its much easier to make errors with and it is harder for the computer to execute. Unless there is a reason why you can’t know the type of a parameter or variable at compile time, always type label it.