Quick animation question

How would I script so that if an animation is playing you have to wait until it finishes before you can play another animation?

if(!animation.IsPlaying(“name”)){ // Checks if animation named name is not playing
//play the other animation right here.
}