Loop audio "x" amount of times then stop

NOOB Alert! I have a sound effect that plays on awake. I want it to loop 7 times then stop. Can anyone help me out with the script?

public var audioSource : AudioSource;
public var audioSourceOnThisObject : boolean = true;
public var repeatAmount : int = 7;
private var currentRepeat : int = 0;

function Start ()
{
    if (audioSourceOnThisObject)
        audioSource = gameObject.GetComponent.<AudioSource>();
}

function Update ()
{
    if (!audioSource.isPlaying) 
    {
        if (currentRepeat < repeatAmount)
        {
            audioSource.Play();
            currentRepeat++;
        }
    }
}

This is a basic JS example of how you would go about doing it.