Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

turnary operator c#

//condition ? consequent : alternative
//is this condition true ? yes : no

int x = 20, y = 10;

var result = x > y ? "x is greater than y" : "x is less than y";

Console.WriteLine(result); // x is greater than y
Source by learn.microsoft.com #
 
PREVIOUS NEXT
Tagged: #turnary #operator
ADD COMMENT
Topic
Name
7+3 =