Flashlight script help!

I’m new to C# and am aware of many different solutions to my problem, but basically, I was wondering if there is a way to use a flashlight sound for on and a flashlight sound for off when using light.enabled = !light.enabled. If there is a solution that would be great, but I cant find one, so I resorted to writing this alternative script. But for some reason, the play in “audio.Play” is highlighted in red and says it does not exist in this context. I’ve had a look at Unity’s documentation and I cannot spot any differences. Can anybody help me out?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class flashlight2 : MonoBehaviour 
{

	public Light light;
	public AudioClip soundOn;
	public AudioClip soundOff;

	void Start () 
	{
		light.enabled = false; 
	}

	void Update () 
	{
		if (Input.GetKeyDown (KeyCode.F)) 
		{
		if (light.enabled == true)
			light.enabled = false;
			audio.Play(soundOn);
		} 
		else 
		{
			light.enabled = true;
			audio.Play(soundOff);
		}
	}
}

You need a reference to the audio source. At the moment the audio in audio.Play(); means nothing.
Try this

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class flashlight2 : MonoBehaviour 
 {
 
     public Light light;
     public AudioClip soundOn;
     public AudioClip soundOff;
     public AudioSource audio;
 
     void Start () 
     {
         light.enabled = false; 
         audio = GetComponent<AudioSource>();
     }
 
     void Update () 
     {
         if (Input.GetKeyDown (KeyCode.F)) 
         {
         if (light.enabled == true)
             light.enabled = false;
             audio.Play(soundOn);
         } 
         else 
         {
             light.enabled = true;
             audio.Play(soundOff);
         }
     }
 }

To play audio You should use AudioSource instead of AudioClip.
You also miss some curly brackets in your script for proper logic.