Only assignment, invocation, increment, decrement and new object expressions can be used as an operator
2 answers
Yes - because you don't do anything with the result of the conditional expression. You have a conditional statement that tries to be an integer statement. In a simpler version:
bool condition = true;
int x = 10;
int y = 5;
// This is invalid
condition ? x : y;
What did you want to do with the result of the conditional expression? If point were to assign it to a variable, then you need to do that. Currently, you have two separate statements: one declares remarks
and assigns a value to it; the second is a conditional expression.
If you are trying to do something else, you need to clarify what you are looking for.
+19
source to share