why declare boolean value before functions didnt work?

Hi Guys,

The clockIsPaused (boolean type) only returns true if I declare it in the function. But why at the top or before the function, it didn’t work? I thought we can input all the values when we declare the var which type and before all function start?

(I know it’s sounds silly,that function is where all the process of code start) I’m just curious.

#pragma strict

var clockIsPaused : boolean = true;
function Start () 
{
	//clockIsPaused = true;// even if I put the boo lean in the declare top it,
//it is still as false, why?
    }

function Update () {
	Debug.Log(clockIsPaused);
}

Because it is automatically public and it is set to false in on our GameObject. Once the script is attached to GameObject values are taken from GameObject (in the inspector), not from declaration.

Solution: make it private. Or change it on start/awake.