Euler Angles question

I want my object to straighten out after rotating on the z-axis. Here is my script - it doesn't seem to do anything. What is wrong with it? function Update (){

var rotationz = transform.eulerAngles.z;
if ((rotationz > 5) && (rotationz < 180)){
transform.Rotate (0,0,-30*Time.deltaTime);
}
if ((rotationz > -5) && (rotationz < -180)){
transform.Rotate (0,0,30*Time.deltaTime);
}
}

Thanks.

Your second if statement seems wrong if you want it to be the same as the first if statement but with negative values. I'd assume you mean to write this instead.

function Update (){
    var rotationz = transform.eulerAngles.z;
    if ((rotationz > 5) && (rotationz < 180)){
        transform.Rotate (0,0,-30*Time.deltaTime);
    }
    if ((rotationz < -5) && (rotationz > -180)){
        transform.Rotate (0,0,30*Time.deltaTime);
    }
}

Notice that when testing against negatives the greater than and less than signs are flipped.