Ternary Operator in C#
Ternary operator:-
The Ternary operator is not a type of conditional statement but it is also used to check the conditions. It returns only one value based on conditions. Use the ternary operator to check many values in a single line of coding.
The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. Following is the syntax for the conditional operator.
Syntax:-
Variable = condition ? first_expression : second_expression;
Source Code :-
No comments:
Post a Comment