variable = (condition) ? expressionTrue : expressionFalse;
int time = 21;if (time < 19){Console.WriteLine("Good day.");}else{Console.WriteLine("Good evening.");}
int time = 21;string result = (time < 19) ? "Good day." : "Good evening.";Console.WriteLine(result);
Conditional Assignments: Set a variable based on a condition.Inline Decisions: Use it directly in expressions or method calls.
You must be logged in to post a comment.
Username or Email Address
Password
Remember Me