Rotation problem

Hi!
My code doesn’t work. Pls, give me an advice how to do this.
Picture is below.
if (transform.eulerAngles.z >= -90 && transform.eulerAngles.z <= 90) { Debug.Log("Go back"); }
159483-ua4.jpg

I’m not an expert with rotations but first of all I’m pretty sure you should use transform.rotation when checking rotation or use transform.localRotation if object has parent. If one of these doesn’t work give a little more info.