Yield before the next update

I would like to make a function that changes a variable immediately, but return to a default value before the next update

function Start ()
{
	test();
}

function Update ()
{
	if(testing)
	{
		Debug.Log("frame tested: "+Time.frameCount);
	}
}

private var testing : boolean;
function test()
{
	testing = true;
	yield;
	testing = false;
}

in this sample code the variable keep true in the first and second frame, but I want a true value only in the first frame

A yielded coroutine will resume execution after all the Update() methods in the current frame have been called. Use:

yield new WaitForEndOfFrame();

in your code rather than yield.

EDIT: Actually, I don’t think you need the new keyword in UnityScript. =P