RE: The best way to toggle a boolean variable. 07-16-2018, 06:00 AM
#2
Sure, but it's not very readable... It's something that works but probably shouldn't do... like I can do a basic addition of two numbers using XOR as well...
but am I actually going to? And sure, you could argue that it's convenient for very long variable names but that seems like a totally contrived example because if you have super long variable names, you have another issue. But maybe it's just me. ¯\_(ツ)_/¯
Code:
int one = 1, two = 2;
int three = one ^ two;
but am I actually going to? And sure, you could argue that it's convenient for very long variable names but that seems like a totally contrived example because if you have super long variable names, you have another issue. But maybe it's just me. ¯\_(ツ)_/¯
(This post was last modified: 07-16-2018, 06:01 AM by reGEN.)