Disable / enable script

Wanted to know how to disable / enable script on a gameObject using a boolean variable
(true = on and false = off).

Thanks.

If you want to disable the script,get the script component.
Like:

SomeScript someScript=gameObject.GetComponet();

someScript.enable=false;//disable;

someScript.enable=true;//enable;

And in the script,you can write like:

this.enable=false;

this.enable=true;

enable = myBooleanVariable;