Use animation to trigger code

I am trying to figure out how to run some code when an animation ends but have so far only found the opposite (trigger animation with code).

Is there a way to do this?

You can use Curves or Events, if we are talking about Mecanim.

http://unity3d.com/learn/tutorials/modules/beginner/animation/animation-curves-events

If we’re talking about the old animation system, then you can use the Events there as well.