15. What is the use and syntax of a ternary operator
Answers
Answered by
1
Explanation:
The ternary operator is used to execute code based on the result of a binary condition.
It takes in a binary condition as input, which makes it similar to an 'if-else' control flow block. It also, however, returns a value, behaving similar to a function
Answered by
2
Answer:
A ternary operator can be used to replace a traditional if.. else statement block.
the basic syntax of a ternary operator is
condition ? value_if_block : value_else_block;
Hope you like it. :-)
Similar questions