Why is my quaternion not working?

My code is not erroring out; it just isn’t working.

    public Quaternion theMaxRotatoion;
    
    void Start()
    {
        //The maximum rotation should be 90
         theMaxRotatoion.x = 90f;
    }


    void Update()
    {
      //If this game object is over 90, it should alert me in the console.
        if (this.transform.rotation.x > theMaxRotatoion.x)
        {
            Debug.Log("It's over 90");
        }
    }

Because a Quaternion does not represent Euler Angles which you seem to assume. Quaternions are a 4 dimensional extension of the complex numbers (hence "Quat"ernion). The 4 components of a unit quaternion are always in the range -1 to 1. If you want to know more about quaternions I recommend this numberphile video and this 3B1B video.

If you’re looking for an euler angles representation of the orientation of a Transform you can use transform.eulerAngles. However be aware of the fact that those are actually calculated backwards from the quaternion representation. Also note that euler angles do not have a unique representation for a certain orientation and also suffers from gimbal lock. Specifically in Unity’s gimbal setup, the value you want to test against is the exact gimbal lock case. The x euler angle doesn’t really get larger than 90°

@Bunny83 perfect description. As for your furthur help. Our normal mind think rotation as 3 angles. XYZ. and quaterion is a little difficult. so If you want to clamp, try converting quaternion to euler angles.
like transform.rotation.eulerangle.x, transform.rotation.eulerangle.y, transform.rotation.eulerangle.z.

hope this could help.