C# (or other programming languages also) allows to use a conditional/ternary operator within another conditional/ternary operator.
Syntax:
(logical_test1) ?
((logical_test2)? True_block : false_block) :
false_block_outer;
If logical_test1 is true then logical_test2 will be checked, if it is true then "true_block" executes, else "false_block" executes, and if logical_test1 is false then "false_block_outer" will be executed.
Note: Inner conditional operator can be used in any block as per the requirement.
C# example for nested conditional/ternary operator
Here, we are asking to input three numbers and finding the largest number.
Output
need an explanation for this answer? contact us directly to get an explanation for this answer