unity – Why does only the sound for turning off the flashlight play?

This script is supposed to play a sound when I turn on the flashlight sprite and a different sound when I turn it off, but for some reason it’s only playing the second sound.

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

public class flashlightonoffsound : MonoBehaviour
{
    public static bool flashlightisoff = false;

    public AudioSource flashlightsound1;

    public AudioSource flashlightsound2;
  
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (flashlightisoff)
            {
                flashlightsound1.Play();
            }
            else
            {
                flashlightsound2.Play();
            }
        }

    }
}