Spotlight on/off C#

So i have a spotlight connected to the torch on my gun. and i have made the script so when i press F the flash light turns on, then when i press F again it turns off. the light turns off but it doesn’t turn back on (The light is on when the game loads)

the script is attached to the spotlight. please give the answer in C#.

void Update ()
{
	if (Input.GetKeyDown(KeyCode.F))
	{
		if (light.enabled = true)
		{
			light.enabled = false;
			Debug.Log("light is now false");
		}
		if (light.enabled = false)
		{
			light.enabled = true;
			Debug.Log("light is now true");
		}
	}
}

You need to use == signs for your tests. Currently you are setting the value in your if statements not checking it!