How do I make something rotate until a condition is met

I want to make a game object rotate until its Z axis it’s pointing towards a specific point. I have a variable named angle which is the angle between the object’s Z axis and the position of the point which it needs to point to. I have the following code right now:

while (angle > 0)
			{
				transform.Rotate (Vector3.right * rotationSpeed * Time.deltaTime);
				transform.Rotate (Vector3.up * rotationSpeed * Time.deltaTime);
			}

but it always ends up in an infinite loop and crashing because it just rotates by the amount I’m telling it to. So is there any way to tell the object to keep rotating until the angle is 0?

If the point you want to point towards is a rotation vector you can use RotateTowards, I believe.

Quaternion myQuat = Quaternion.Euler(transform.localEulerAngles);
Quaternion targetQuat = Quaternion.Euler(YOURTARGETVECTOR);

while(myQuat!=targetQuat)
{
transform.localRotation = Quaternion.RotateTowards(myQuat, targetQuat, 10.0f);
myQuat = Quaternion.Euler(transform.localEulerAngles)
}