I want to understand why the following code does not work.
private int calculate(int param) {
int a = 0; int b = 0;
return a + b + param == 0 ? 1 : 0;
}
I know you can make the function above work like this
private int calculate(int param) {
int a = 0; int b = 0;
int val = param == 0 ? 1 : 0;
return a + b + val;
}
but I want to understand why the first code does not work.
Thanks in advance!