boolean as function parameter/argument

Below is my code. I expect test to be “True” after I call “revert(test)”. However, Debug.Log prints out “The value of test in GameManager is False”. In the Start() function, if I just write “test = !test” then test would equal to “True”. I don’t know what’s wrong with my code.

#pragma strict

var test : boolean = false;

function revert (a : boolean)
{
	a = !a;
}

function Start () {
	revert (test);
	Debug.Log ("The value of test in GameManager is " + test);
}

function Update () {

}

You do not return anything from your function or modify your test boolean.

test and a are not linked. Variable a exists only within the function.

function revert () { test = !test; }

or

function revert (a : boolean)
{
    a = !a;
    return a;
}

function Start ()
{
    test = revert (test);
    //etc

I would write it that way :

#pragma strict

var test : boolean = false;

function revert (a : boolean) : boolean {
	return !a;
}

function Start () {
	test = revert (test);
	Debug.Log ("The value of test in GameManager is " + test);
}