Variable remains 0

Probably pretty obvious question, but I’m learning Javascript by trying shit out (thus far, it works fine).
My variable ‘time’ remains 0. It’s probably because I say “public var time = 0” at the start of my program, but how else should I declare it?

public var time = 0;
function Update () {
	time+= Time.deltaTime;
	print(time);
}

function OnGUI(){
	GUI.Box (new Rect(Screen.width-160, 10, 150, 40), "Time: " + time);
}

It’s public because I will need to access it from my Reset() function (in another class) later.

public var time = 0;
function Update () {
time+= Time.deltaTime;
print(time);
}

function OnGUI(){
    GUI.Box (new Rect(Screen.width-160, 10, 150, 40), "Time: " + time);
}

It is because time is an int and Time.deltatTime is a float.

Simple change:

public var time = 0;

To:

public var time = 0.0;

And it should work perfectly now.

Yep, that makes sense. I want to explicitly make it a float, so that would be “public var time:float = 0”, right?