Smooth rotation in unity?

Im trying to make a gameobject rotate 45 degrees when scrolling the mousewheel, and i have tried everything to make the rotation smooth, but i just cant do it for some reason.

Right now my script is this (i know this doesnt even try to make it smooth, but I just gave up.)

if (Input.GetAxis(“Mouse ScrollWheel”) > 0f) //up
{
transform.Rotate(0, 0, -45);
}
if (Input.GetAxis(“Mouse ScrollWheel”) < 0f) //down
{
transform.Rotate(0, 0, 45);
}

Does anyone know how i do it?

What you’re looking for is called linear interpolation.

Refer to the documentation of Quaternion.Lerp