How to set the second variable in the Quaternion.RotateTowards() funtion?

I keep getting errors when trying to set the second variable when using Quaternion.RotateTowards(). I want the object to rotate from its current rotation to 180 degrees its the Z axis.

transform.eulerAngles = Quaternion.RotateTowards(transform.eulerAngles, 180 DEGREES ON ITS Z AXIS, rotationSpeed);

I’ve checked everywhere YouTube videos, Google and the documentation I can’t find anything that properly explains how to use Rotate.Towards. I can only find examples of how to use RotateTowards to rotate to another object instead of a typed in variable.

RotateTowards will rotate the selected object #1 until it has the same rotation values as the other object #2.

The parameters are:
#1: The rotation of the object you want to rotate.
#2: The final rotation you want your object to have when it’s all finished.
#3: Rotate step

Now in your specific case, you might want to do something like this:

public Quaternion target = transform.rotation;
public float speed;

void Start() 
{
   // Get the final rotation which is 180 degrees around Z axis.
   target = Quaternion.AngleAxis(180, Vector3.Forward);
}

void Update()
{
   float step = speed * Time.deltaTime;
   // Now you can rotate to a value instead of to another object's rotation.
   transform.rotation = Quaternion.RotateTowards(transform.rotation, target.rotation, step);
}