How to do boolean exclusive or?

2020-07-01 11:39发布

问题:

Apparently there is no boolean version of the bitwise exclusive-or operator (^^^)... what to do?

回答1:

This is provided by the not-equal operator <>.



回答2:

let inline xor a b = (a || b) && not (a && b)


标签: f#