Object not rotating

Hi, Iam using this simple script for rotating an object but for some reason it isnt rotating. Instead it turns only from any point to 180 and then stops rotating.
here is the script:

var speed  = 0.1;

function Update () {

transform.rotation.z  = transform.rotation.z + speed;


If I change the rotation to position, the script works so what is it?

#pragma strict

var speed :float = 20.0;

function Update(){

transform.Rotate(0,0, speed*Time.deltaTime);