this is a ? : Ternary Operator
it is return one of two values depending on Boolean condition
Syntax:
condition ? expressionIfTrue : expressionIfFalse;
Example:
string name = "hamid";
Console.WriteLine(name == "hamid" ? "The name is hamid" : "The name is not hamid");
so it will return : The name is hamid
Console.WriteLine(name == "hamidXYZ" ? "The name is hamid" : "The name is not hamid");
so it will return : The name is not hamid
it is return one of two values depending on Boolean condition
Syntax:
condition ? expressionIfTrue : expressionIfFalse;
Example:
string name = "hamid";
Console.WriteLine(name == "hamid" ? "The name is hamid" : "The name is not hamid");
so it will return : The name is hamid
Console.WriteLine(name == "hamidXYZ" ? "The name is hamid" : "The name is not hamid");
so it will return : The name is not hamid
No comments:
Post a Comment