开发者

How to do boolean exclusive or?

开发者 https://www.devze.com 2023-04-10 12:34 出处:网络
Apparently there is no boolean version of the bitwise exclusive开发者_运维百科-or operator (^^^)... what to do?This is provided by the not-equal operator <>.let inline xor a b = (a || b) &&a

Apparently there is no boolean version of the bitwise exclusive开发者_运维百科-or operator (^^^)... what to do?


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


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

精彩评论

暂无评论...
验证码 换一张
取 消