Easiest way to flip a boolean value?

前端 未结 13 1469
后悔当初
后悔当初 2020-12-04 08:31

I just want to flip a boolean based on what it already is. If it\'s true - make it false. If it\'s false - make it true.

Here is my code excerpt:

swi         


        
13条回答
  •  青春惊慌失措
    2020-12-04 09:30

    The codegolf'ish solution would be more like:

    flipVal = (wParam == VK_F11) ? !flipVal : flipVal;
    otherVal = (wParam == VK_F12) ? !otherVal : otherVal;
    

提交回复
热议问题