timer for dash mechanic

I’m fairly new to using coroutines and I think I’m doing something wrong. I’ve implemented a dash mechanic and I’m trying to use a coroutine as a timer to keep the player from just spamming the dash button. However, it does not seem to be working. When I step through the code, it seems to be behaving exactly as I would expect… but when I play it isn’t. Hoping someone can quickly see what i’m doing wrong.

        if(Input.GetKeyDown(KeyCode.LeftShift) && canDash && isOnGround)
        {
            if(Srend.flipX)
            {
                rb.AddForce((Vector2.right * -1 * dash) * Time.deltaTime * 70, ForceMode2D.Impulse);
            }
            if(!Srend.flipX)
            {
                rb.AddForce((Vector2.right * 1 * dash) * Time.deltaTime * 70, ForceMode2D.Impulse);
            }
            canDash = false;
            StartCoroutine(DashTimer());
        }


    private IEnumerator DashTimer()
    {
        float timer = 0f;
        while(timer < 5000)
        {
            timer += Time.deltaTime;
        }
            yield return canDash = true;
    }

Ah I figured it out. I was going about this entirely wrong. Here is the updated coroutine code:

    private IEnumerator DashTimer()
    {
        yield return new WaitForSeconds(5f);
        canDash = true;
    }

Obviously 5 seconds is way too much for a dash cooldown, just set it really high so I could make sure it was working. lol.