Remeber the value between frame Update()

Hello, dear community! I wonder if it is possible to rember the value of the previous Update()?
I have a simple game, where a character shoots while moves in the direction he moves. But when he stands the vector direction is 0.0.0. Is it possible to remeber the previous direction? The script is attached for your convenience.

Any help is apprecited!
public var rocket : Rigidbody2D;
var situation: float;
var old_position : Vector2;

	function Start()
	{
	old_position = transform.position;
	}


	function Update() {
//if a player is moving
if(transform.position != old_position)
{

	var newVector: Vector2  = transform.position - old_position;
	var coordinates = GameObject.Find("professor").transform.position;
    	
    
			if (Input.GetMouseButtonDown(0))
			{
			var b: Rigidbody2D = Instantiate (rocket, coordinates, Quaternion.identity); 
			var force =10;
	 		b.rigidbody2D.AddForce(newVector.normalized * force / Time.fixedDeltaTime);
	 		}

	old_position = transform.position;
}
 
   

//if a player stands still
if(transform.position == old_position)
{

			if (Input.GetMouseButtonDown(0))
			{
			var b3: Rigidbody2D = Instantiate (rocket, coordinates, Quaternion.identity); 
			var force3 =10;
			b3.rigidbody2D.AddForce(newVector.normalized * force3 / Time.fixedDeltaTime);
		   	}

} 
}

You just need to declare “newVector” to be a script variable, just as you did with the variable “old_position”.

Just change the line “var newVector: Vector2 = transform.position - old_position;” into “newVector = transform.position - old_position;” and add another line “var newVector : Vector2;” right under the similar line where you declare old_position.