Getting a rotating object to stop rotating on key press

Hi, newb here. My scene begins with a cube rotating in the middle of the screen. On a key press, the cube successfully faces the camera, but will not stop rotating. How can I get the cube to stop rotating at a button press? Thanks!

public bool rotateCube = true;

void Update () 
{
	if (rotateCube = true)
	{
		transform.Rotate(new Vector3(30, 30, 10) * Time.deltaTime);
	}
	if(Input.anyKey)
	{
		Debug.Log("Any Key has been pressed");
		transform.rotation = Quaternion.LookRotation(-Camera.main.transform.forward, Camera.main.transform.up);
		rotateCube = false;

	}
}

You are missing a = in your first if check. With only a single = you are basically setting the variable “rotateCube” to be true before checking if it is true, it will therefore always be true and the cube will always rotate.

To check if something is equal to something you have to use two = symbols:

if (rotateCube == true) // == instead of =
{
   transform.Rotate(new Vector3(30, 30, 10) * Time.deltaTime);
}