Check out example codes for "bool toggle unity c#". It will help you in understanding the concepts better.

Code Example 1

private bool togl;

togl = !togl; //this is what changes the bool the the other state

Learn ReactJs, React Native from akashmittal.com