flashlight on/off

how do i turn on and off a pointlight i made the torch and everything and i cant figure out how to access this thankyou btw i prefer C# but dont mind if u cant

Two simple approaches are that you could enable/disable the light or zero/un-zero the intensity:

//Somewhere
Light bar = foo.GetComponent<Light>();

//Somewhere later, switch the light on/off
if(bar) bar.enabled = !bar.enabled;

or

//Somewhere
Light bar = foo.GetComponent<Light>();
float oldIntensity = 0.0f;

//Somewhere later, switch the light on/off
float temp = bar.intensity;
bar.intensity = oldIntensity;
oldIntensity = temp;