can you play an animation in reverse unity code example

Example: unity play animation backwards

using UnityEngine;
using System.Collections;
 
public class NewBehaviourScript : MonoBehaviour {
	Animation anim;
	// Use this for initialization
	void Start (){
		anim = GetComponent<Animation> ();
		anim.Play ("cubeanimation");
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.A)) {
			// Reverse animation play
			anim ["cubeanimation"].speed = -1;
			anim ["cubeanimation"].time = anim ["cubeanimation"].length;
			anim.Play ("cubeanimation");
		}
	}
}