+ 2
What is conditional operator ?
hi friends what is conditional operators
3 Respuestas
+ 4
The conditional operator is also called ternary operator, because it's structure consists of three parts:
? : ;
Example:
[return] = [condition] ? [return if condition is true] : [return if condition false];
What the ternary operator is doing is first evaluating the [condition]. If it is true it will assign [return] the value [return if condition is true], otherwise it will assign [return] the value [return if condition is false].
Here is a nice picture that summerizes what I just said above:
http://img.c4learn.com/2012/02/Conditional-Statement-in-C-Programming-Lanuage-Ternary-Operator.png
+ 2
if my answer was of any help to you, then please consider marking it as the best answer. Thanks in advance.
+ 1
Thanks bro