1
I have the following doubt:
I have a function that can give me four different values. I would like to create a message (string) for each function value, so that the message is released with its respective value, for example:
If the function returns B, I have message B, if the function returns value A, I have message A...
code:
Double N1 = N1(b, a, A, B, C, D);
String resultado = (N1 == A && N1 < nM ? "Tipo A" : (N1 == B && N1 < nM ? "Tipo B": (N1 == C && N1 < nM ? "Tipo C" : (N1 == D && N1 < nM ? "Tipo D" : "Passa!"))));
The function value is N1, which can be if A, B, C or D. In addition, the "Type X" message should only appear if N1 is less than double nM. If nM is less than N1, I must return the message "Passes!"
The problem is the message I get is always "Pass!" even when nM is greater than N1.
How should I proceed?