C ternary operator is a shorthand of combination of if and return statement. Syntax of ternary operator are as follows:
(expression1 ) ? expression2: expression3
If expression1 is true it returns expression2 otherwise it returns expression3. This operator is a shorthand version of this if and return statement:
(expression1 ) ? expression2: expression3
If expression1 is true it returns expression2 otherwise it returns expression3. This operator is a shorthand version of this if and return statement:
if(expression1) return expression2; else return expression3;
If you like this please Link Back to this article...
0 comments:
Post a Comment