Animation play after the first one has finished

Hello im new to Unity and i want to ask something.I want to make a ThirdPerson Attack system like when i press “1” button to play animation “Attack”.And when i release it to play the animation “Stand”.But i have a problem i search on the internet and i make a code which is not effective.The problem is when i press one time the “1” button the attack animation stops in the current frame.Only if i keep pressing the “1” button plays normal.I want when i press one time the “1” button to play the animation full framed one time and then to play the animation Stand.Please Help!
Here is my Code:

function Update () {

if (Input.GetKeyDown("1"))    

    animation.Play("Attack");

    

     if (Input.GetKeyUp("1"))    

    animation.PlayQueued("Stand", QueueMode.PlayNow);

}

Maybe what you need is something like this?

if(Input.GetKey("1"))
{
    animation.Play("Attack");
} else {
    animation.Play("Stand");
}

If i understand you right, you need to use a different QueueMode:

animation.PlayQueued("Stand", QueueMode.CompleteOthers);