Rotation with limits not working?

So I’m trying to get a tank to aim its’ gun up and down using the “q” and “e” key, the buttons work on their own but I want there to be a limit to the degrees on the y axis to how far down or how far up the gun can aim. the bool for up and down is to check whether or not i am able to rotate the GameObject up or down. Aiming up works well and is true as long as it’s under 79 degrees, but for some reason aiming down never works and is off the entire time…i know that below 0 degrees just goes off from 360 degrees so i set it to no less than 10 degrees…is there something i’m missing, or is my code a bit flawed in the way it calls the actual rotation it’s currently in?

there is a public gameobject that is just the sphere (or empty gameobject) that rotates the child cube that is the actual gun on the tank so that the sphere is the only thing that rotates changing the rotation of the cube along with it. The default position i set it to on the y Rotation is set at 40 degrees so that when i start the game, i can make sure that both functions should be set to true.

public GameObject Trajectory;

public bool Up = true;
public bool Down = true;

public int rotationSpeed = 30;

// Update is called once per frame
void Update () {

	if (Trajectory.transform.rotation.eulerAngles.y > 79) {
		Up = false;
	} else {
		Up = true;
	}

	if (Trajectory.transform.rotation.eulerAngles.y < 10) {
		Down = false;
	} else {
		Down = true;
	}

	if (Up == true) {
		//AimUp
		if (Input.GetKey(KeyCode.E)){
			Trajectory.transform.Rotate(Vector3.up * rotationSpeed * Time.deltaTime);
		}
	}

	if (Down == true) {
		//AimDown
		if (Input.GetKeyDown(KeyCode.Q)){
			Trajectory.transform.Rotate(-Vector3.up * rotationSpeed * Time.deltaTime);
		}
	}

	Debug.Log (Trajectory.transform.rotation.eulerAngles);
}

Just remove these bool functions completly and use Mathf.Clamp ( check API if there are question to it)

code could look like:

//min max in Degree
float minAngle;
float maxAngle;

//aim up
//aim down
        
//after the input u clamp
Vector3 tAngles = Trajectory.transform.rotation.eulerAngles;
tAngles.y = Mathf.Clamp (tAngles.y, minAngle, maxAngle);
Trajectory.transform.rotation.eulerAngles = tAngles;

these makes sure the angle stays always inside (minAngle, maxAngle)