Inside the if-statement for turning the flashlight on/off, just play the audio by calling audio.play. This is assuming the audio source is in the same game object as the script is in. Otherwise, just pass in the audio source and call that audio source to play the audio.
Try something like below. You should really just go through some Unity coding tutorials - they will teach you how to do all that stuff.
using UnityEngine;
using System.Collections;
public class FlashLight : MonoBehaviour {
private bool FlashLightOn = false;
public AudioClip soundOn;
public AudioClip soundOff;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetButtonDown("togglelight") FlashLightOn == false){
FlashLightOn = true;
if (soundOn)
audio.PlayOneShot(soundOn);
light.intensity = 2;
}
else if(Input.GetButtonDown("togglelight") FlashLightOn == true){
FlashLightOn = false;
if (soundOff)
audio.PlayOneShot(soundOff);
light.intensity = 0;
}
}
}