Co-routines C#, rotating an object

I am trying to rotate an object 90 degrees.

int i = 0;
IEnumerator Rotate() {
	 
	Quaternion oldRotation = transform.rotation;
	transform.Rotate(0,90,0);
	Quaternion newRotation = transform.rotation;

	for (float t = 0.0f; t < 1.0; t += Time.deltaTime * rotateSpeed) 
	{ 
        Debug.Log(i++);
		transform.rotation = Quaternion.Slerp(oldRotation, newRotation, t); 
		yield;
	}
	
	rotating = false;
}

I get an error CS0201 on the line with the yield statement.

Change the following line :

yield;

And put :

yield return null;

The return type of the coroutine must be IEnumerator. And you should start the coroutine as follow : StartCoroutine( Rotate() ) ;

hi;
thats not a Corutin Function; u should read about them;
i give u a correct way to rotate objects;

 Coroutine co; 
public void Rotate (Transform ObjToRotate) {

        if ( co == null)
        co = StartCoroutine(RotateMe(ObjToRotate, Vector3.forward * 90 ));
 
    }

 Quaternion toAngle;
    IEnumerator RotateMe(Transform rotateobj, Vector3 byAngles )
    {
 

        //Quaternion fromAngle = rotateobj.transform.rotation;

            toAngle = Quaternion.Euler(rotateobj.transform.eulerAngles + byAngles);
      
      
        while (rotateobj.transform.rotation != toAngle)
        {

            rotateobj.transform.rotation = Quaternion.RotateTowards(rotateobj.transform.rotation, toAngle ,7f  );
             
            yield return null;
        }

to rotate an object call the Rotate() method and send with it the object u want to rotate ;