Looking for a Special Delay Library

Here is my attempt. This I think should've worked. Can you explain why not?:

    //special delay function
    unsigned long millis();
    int timeOld = millis();
    int x = 1;
    while (x < 2 )
    {
      int timeNew = millis();
      if ((timeNew - timeOld) >= pauseBetweenNotes)
      {
        x = 3;
      }
    }