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