Toggling Boolean states in one action

Just wanted to share a quick tip to toggle Boolean states in one action. This saves the need to have 2 different events for an element click that toggles a yes/no state.

Simply put: Boolean state's current state is no will toggle.
Don’t think about it too much trust me.

5 Likes

holy sht man, dont know what to say to this lmao, one of the weirdest and best tricks to date imo, definitely implementing, hope they don’t fix this

This isn’t a bug, it’s logic. Commonly called “Negation logic (NOT)”, “Boolean inversion”, “Inverse condition”, it’s been used for a long time by many users and is available on the forum in some threads.

2 Likes

whelp, i wish i knew it earlier, also guessed it’s not a bug but wasn’t sure