Just assign using the logical NOT operator !
like you tend to do in your condition statements (if
, for
, while
...). You're working with a boolean value already, so it'll flip true
to false
(and vice versa):
myBool = !myBool;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…