When 2 buttons pressed animation stops?

Hey,
So im doing a walking animation. I currently use this script to make it loop when holding the buttons down.

#pragma strict
    function Update()
    {
    if(Input.GetKey(KeyCode.W))
	animation.Play("walk");
if(Input.GetKey(KeyCode.S))
	animation.Play("walk");
if(Input.GetKey(KeyCode.A))
	animation.Play("left");
if(Input.GetKey(KeyCode.D))
	animation.Play("right");
	
	else if(!Input.anyKey)
animation.Play("idle");

     
    }

However when i press 2 of the buttons down such as D & S It just freezes the animation and doesn’t play anything?

This is obviously because the two animations are conflicting when trying to play but How can i get around this?

Thanks

Change your subsequent if statements to else if statements, so that only one gets executed?