Waiting until animation is finished

I am trying to set a variable to true, but only AFTER the animation has finished, is there a way to do this?

Doing animation.play(“blah blah”)
then setting it to true doesn’t work.

Could do a simple yield return new WaitForSeconds(animation.clip.length); Then set your variable.