How can i disable a rotation when it rotates to 90 degree in Y axis but still pressing "Q" button ??

The script is like this:

function Update () {

var spinAmount = Time.deltaTime * speed; </p>
if (Input.GetKey(KeyCode.Q)){
    transform.Rotate(0, spinAmount, 0);}

}

Ok here is something you can try.

 `
    function Update () {
var spinAmount = Time.deltaTime * speed;

if (Input.GetKey(KeyCode.Q)){
    if(!transform.rotation.y => 90){
        transform.Rotate(0, spinAmount, 0);}
    }
}
`

This just says if rotation arround the y axis not greater than or = to 90 degree's then rotate.