Algorithm for enabling and disabling components

I have such a problem: I want to implement turning the light on and off with one key, but nothing works. I tried many times to rewrite the code but it does not help. But everything starts working as soon as I change the “F” key to any other, but this is inconvenient. Thank you!

_lig<em>.GetComponent<Light>.enabled = !_lig*.GetComponent<Light>.enabled.*
This is one way to do it.
Checking if _ligh >= 2 is also unnecessary since you set it to 1 the line before.