Turn code on and off

Hi guys i want to know how i can turn code on and off in the inspector. So if i turn it of something doesn’t work.

i know it would be something like if on = false (cant do anything) but if on = true (do smomthing )

Please help?

Click that checkbox next to the name of the script. POOF script disabled.

var runCode = true;

function Update ()
{
if(runCode)
{
//Do the thing you want to when it is turned on
}
}