How to tell in script if an animation has stopped playing? :)

Hey, so i was wondering, how do i tell in a script that the animation has finished?

-Thanks!! :)))

if (!animation.IsPlaying("animation name"))
            //Do stuff

that might not always be what you want. For more precise detection. Do something like:

IEnumerator WaitForAnimation (Animation animation) {
    do {
        yield return null;
    } while (animation.isPlaying);
}