if((a==null && b!=null) || (a!=null) && b==null) 有啥简便写法?
1
am241 2017 年 5 月 22 日 via Android
分语言
c 可以用真值异或,或者真值相加=1 某些其他需要就老老实实正常写吧 |
2
drush 2017 年 5 月 22 日
php 有个 xor operator
$a xor $b Xor TRUE if either $a or $b is TRUE, but not both. |
4
drush 2017 年 5 月 22 日
|
5
M3oM3oBug 2017 年 5 月 22 日 via Android
这就跟 2 块硬币的正反是一样的,同时为正是一种情况,一正一反是有两种情况的呀,想写就自己弄个方法返回特征码,以后直接调用方法那就是一行语句了
|
6
princelai 2017 年 5 月 22 日
python
bool(b) ^ bool(a) bool(b) != bool(a) |
7
misaka20038numbe 2017 年 5 月 22 日
if((a == null or b == null) and a != b)
|
8
weyou 2017 年 5 月 22 日 via Android
python
bool(a) is not bool(b) |
9
SoloCompany 2017 年 5 月 22 日
@esolve java 一样有 ^ 操作符啊
|
10
pagxir 2017 年 5 月 22 日
if((a==null) != (b==null))
|