How to smoothly roate a cube by 90 degrees.

I am trying to use this but it is not working.

        transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0,0,90),0.01f);

You must use lerp in MonoBehaviour Update to make it works.

Thank you. The main problem i had was that i was calling this in if(bool) and it was runing in realy short amount of time.