How to call an Animation?

Is there a way to write a code where lets say you press spacebar and it would call a certain animation? If so how would i go about doing this after creating the animation in Unity

http://unity3d.com/support/documentation/ScriptReference/Animation.Play.html

and

http://unity3d.com/support/documentation/ScriptReference/Input.GetKeyDown.html