[Tutor] toggle idiom?

Sean 'Shaleh' Perry shalehperry@attbi.com
Wed, 08 May 2002 15:36:15 -0700 (PDT)


> 
> I would argue that
>     a = not a
> is the best way of writing the original code because it clearly
> shows the logic (as apposed to arithmetic) intent of the operation and
> works for all cases the original works for.  The only reason for using
> the original instead of this is if a must be 0 or 1 in the end, rather
> than simply a false or true value.
> 

is there a case where 'a = not a' will yield a value other than 0 or 1?  i am
not aware of one.