how to change a value over time

so i would like to minus a value (i.e. 50) within 0.0166667 second, i have tried startcoroutine in update(not accurate), in while loop (it end in 0 second) and also invoke method in while loop(blow my pc up) . this is the code of the start coroutine in while loop.

 float x = 50, length =  0.0166667, g;
 bool b = true;
 void Update()
 {
      g = Time.time;
      while (x>0)
      {
           StartCoroutine(Tt());
      }
      if(x == 0 && b == true)
      {
           Debug.Log(g);
           b = false;
       }
 }
 IEnumerator void Tt()
  {
      x -= 1;
      yield return new WaitForSeconds(length / 50);
  }

so this will give g =0 in debug.log, which is in accurate, and i am not sure whether it is the problem of Time.time or my code.

I managed to get a result using the code below. There were a few errors. Float values such as length need ‘f’ to be placed at the end to signify a float - length = 0.0166667f; IEnumerator does not require void return type, simply IEnumerator Tt() works.

I used a while loop in the enumerator to check if x > 0 and if so the minus 1 and yield.

float x = 50, length = 0.0166667f, g;
    bool b = true;

    void Start()
    {
        StartCoroutine(Tt());
    }
    void Update()
    {
        g = Time.time;
        if (x == 0 && b == true)
        {
            Debug.Log(g);
            b = false;
        }
    }
    IEnumerator Tt()
    {
        while (x > 0)
        {
            x--;
            yield return new WaitForSeconds(length / 50);
        }
    }