Thursday, June 12, 2014

[ MSDN.Microsoft.com ] The Conditional Operator in CSharp

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";

Post a Comment

Know us

Our Team

Tags

Video of the Day

Contact us

Name

Email *

Message *