Check out this page for more details => ?: Operator (C# Reference)
int input = Convert.ToInt32(Console.ReadLine());
string classify; // if-else construction.
if (input > 0) classify = "positive";
else classify = "negative";
// ?: conditional operator. classify = (input > 0) ? "positive" : "negative";
No comments:
Post a Comment