making an animation run backwards

Hi i am quite new to unity and am now trying to figure out the movements of an rpg type game. I have a movement script to move forwards backwards etc. and i have added my first animtion for moving forwards. My question is whether there is a way of automatically reversing the animation for moving backwards or whether i have to reanimate it all again

I think that this will work:

for (var state : AnimationState in animation) {
    state.speed = -1;
}

Also you need to set the time of the animation to its lenght.

animation["myAnim"].time = animation["myAnim"].length;

Well if you want your animation to run backwords and forwards over again and again. Then just change it from default animation to pingpong and it will work without scripting.