Michael A. Covington <lo**@www.covingtoninnovations.com.for.address>
wrote:
blah.blither.blatt = ! blah.blither.blatt;
Found it. I can write:
blah.blither.blatt ^= true;
which flips the Boolean value, because it is equivalent to:
blah.blither.blatt = blah.blither.blatt ^ true;
where ^ is xor.
While I'm sure you're right about it working, I don't think that's an
argument to use it - at least not if you think anyone else is going to
read your code. Even though it's fewer characters than
blah.blither.blatt = !blah.blither.blatt;
I would suggest that most people would find the latter far
easier/quicker to understand - and code generally spends more time in
maintenance than being written. If you're that keen on saving space at
the expense of readability, you could just shorten your variable names
and stop using spaces:
a.b.c!=a.b.c;
is shorter than
blah.blither.blatt ^= true;
anyway.
Of course, if this is all just an academic exercise for interest's
sake, that's a different matter.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too