What is the ternary operator?:

It is also a decision making operator ?:. it’s short form of if-else condition.
Syntax:
Condition ? statement1 : statement2
If the condition is true then it execute the first statement after ?, else it will execute the 2nd statement after :
Let’s try to understand with below mentioned example:

ternaryOpertaorExample()
{
int a = 10, b = 15;
string result = a > b ? "a is greater than b" : "b is greater than a";
Console.WriteLine(result);
}

Output:
b is greater than a