Looping Sounds on Keypress

How would I get it so that the sound will loop when a key is pressed, but stop when it comes back up?

var footstepSound : AudioClip;

function Update () {
if (Input.GetKeyDown(KeyCode.UpArrow)){
	audio.PlayOneShot(footstepSound);
}
if (Input.GetKeyUp(KeyCode.UpArrow)){
	//not sure here. I'm a new 'n00b' you see.
}

Thanks.

You must verify audio.isPlaying to avoid starting a new sound while the other is still playing, but since PlayOneShot doesn’t affect isPlaying, you must assign the AudioClip to the audio.clip property and call Play:

var footstepSound : AudioClip;

function Update () {
  if (Input.GetKey(KeyCode.UpArrow) && !audio.isPlaying){
    audio.clip = footstepSound;
    audio.Play();
  }
}

Input.GetKey returns true while the key is pressed.