how to make an object appear and disappear in unity

Code Example - how to make an object appear and disappear in unity

                
                        void Update() {
   if (Input.GetMouseButtonDown(0)) {
     gameObject.active = true;
   }
   if (Input.GetMouseButtonDown(1)) {
     gameObject.active = false;
   }
 }