I have the following question:
I have a function that can give me 4 different values. I would like to create a message (string) for each value of the function, so that the message was released with its respective value, for example:
If the function returns B, I have message B, if the function returns the value A, I get the 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 value of the function is N1, which can be A, B, C or D. In addition, the message "Type X" should only appear if N1 is less than double nM. If nM is less than N1, I should return the message "Pass!"
The problem is the message I get is always "Pass!" even when nM is greater than N1.
How do I proceed?