有人可以解释这行代码
int num1;
int num2;
int num3;
int largest = ( (num1 > num2) ? ( (num1 > num3) ? num1 : num3) : ((num2 > num3) ? num2 : num3));
在IF-Else声明中,所以我能理解
答案 0 :(得分:1)
此
SELECT * FROM A
UNION ALL
SELECT * FROM B WHERE COUNT(SELECT * FROM A) = 0;
相当于
int largest = ( (num1 > num2) ? ( (num1 > num3) ? num1 : num3) : ((num2 > num3) ? num2 : num3));
虽然可以通过以下方式更简单地实现:
int largest;
if (num1 > num2) {
if (num1 > num3) {
largest = num1;
} else {
largest = num3;
}
} else {
if (num2 > num3) {
largest = num2;
} else {
largest = num3;
}
}