How does yield run the remainder of the function?

Does yield run the remainder of function x number of times depending on how long it was yielding?

This seems to spit out “done!” multiple times, when I expected it to do it only once.

var yielded = false;

function Update () {
    if (!yielded)
        Yielding();
}

function Yielding () {
    yield WaitForSeconds (1);
    Debug.Log("done!");
    yielded = true;
}

You’re launching a new coroutine every frame in Update as long as yielding is false, which it is for a full second. You generally don’t want to mix Update with coroutines. If you do launch a coroutine from Update, you have to be sure you only do it once, not every frame.

The function is called multiple times, because of yielding and doing the update cycle again, it repeatedly debuglogs until it the last funcion call is done and no further calls can be made because of the bool value turned to false via the first call.