Toggle a Boolean value on June 13, 2019 Get link Facebook X Pinterest Email Other Apps If you need to toggle a Boolean, don't use an IF statement like a chump! Chumps use: if (myFlag) myFlag = false; else myFlag = true; OR even: myFlag = myFlag ? false : true; Pros use: myFlag = !myFlag; Comments
Comments
Post a Comment