| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
July 04, 2008 Suggestion: Xor Comparison Operator | ||||
|---|---|---|---|---|
| ||||
Pretty much just as the subject says. It's rare and far from major, but I've come across a few places where it would be nice to be able to say "if(A ^^ B)" instead of "if(A && !B || !A && B)". | ||||
July 04, 2008 Re: Suggestion: Xor Comparison Operator | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Nick Sabalausky wrote:
> Pretty much just as the subject says. It's rare and far from major, but I've come across a few places where it would be nice to be able to say "if(A ^^ B)" instead of "if(A && !B || !A && B)".
>
>
!= is xor, genius.
- Gregor Richards
| |||
July 04, 2008 Re: Suggestion: Xor Comparison Operator | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Gregor Richards | "Gregor Richards" <Richards@codu.org> wrote in message news:486DA24F.3090706@codu.org... > Nick Sabalausky wrote: >> Pretty much just as the subject says. It's rare and far from major, but I've come across a few places where it would be nice to be able to say "if(A ^^ B)" instead of "if(A && !B || !A && B)". > > != is xor, genius. > > - Gregor Richards Heh, oh yea :) if((x == 1) != (y != 2)) No reason for that not to work. Too tired today :) | |||
July 04, 2008 Re: Suggestion: Xor Comparison Operator | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Gregor Richards | Gregor Richards Wrote:
> Nick Sabalausky wrote:
> > Pretty much just as the subject says. It's rare and far from major, but I've come across a few places where it would be nice to be able to say "if(A ^^ B)" instead of "if(A && !B || !A && B)".
> >
> >
>
> != is xor, genius.
and <= is implication btw. but it does exhaustive evaluation unfortunately.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply