New course! Every coder should learn Generative AI!
Try a free lesson+ 7
https://code.sololearn.com/cuwpen4HvEay/?ref=app
Made a program demonstrating what you asked. This way you can quickly run it to see how it works.
+ 12
boolean x = true;
x = !x;
+ 6
example code:
boolean b = true;
b = !b;
value of b is now false
+ 1
normaly you would just use x = !x
wich will set true to "not true"/ false