Help with yield WaitForSeconds

Can someone help me with my code? This is my first attempt at using the WaitForSeconds command and im not 100% sure what this error means or how to fix it “Script error (Animation Controller): Update() can not be a coroutine.”

#pragma strict

function Update () {

    if (Input.GetButtonDown("Fire1")) {
    animation.Play("sword", PlayMode.StopAll) ;
    yield WaitForSeconds (0.68) ;
    animation.Play("Idle") ;
 }   
    if (Input.GetKeyDown(KeyCode.W)) {
    animation.Play("Walking", PlayMode.StopAll) ;
}   	 
   	if (Input.GetKeyUp(KeyCode.W)) {
   	Debug.Log ("w up is fine") ;
   	     if (Input.GetButtonUp("Fire1")) {
   	     Debug.Log ("Fire 1 up is fine") ;
   	     animation.Play("Idle", PlayMode.StopAll) ;
}    
}
}

The message is pretty clear. You cannot use a ‘yield’ inside Update(). You can do something like this:

#pragma strict

var swording = false;
 
function Update () {
 
    if (!swording && Input.GetButtonDown("Fire1")) {
        DoSword();
    }   
    if (Input.GetKeyDown(KeyCode.W)) {
        animation.Play("Walking", PlayMode.StopAll) ;
    }        
    if (Input.GetKeyUp(KeyCode.W)) {
         Debug.Log ("w up is fine") ;
         if (Input.GetButtonUp("Fire1")) {
             Debug.Log ("Fire 1 up is fine") ;
             animation.Play("Idle", PlayMode.StopAll) ;
         }    
     }
}

function DoSword() {
    swording = true;
    animation.Play("sword", PlayMode.StopAll) ;
    yield WaitForSeconds (0.68) ;
    animation.Play("Idle") ;
    swording = false;
}

The ‘yield’ has been moved into a separate function. In addition, the ‘swarding’ flag is used to prevent multiple coroutines to be started.