- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The conditional operator or ternary operator first evaluates an expression for a true or false value and then executes one of the two given statements depending upon the result of the evaluation.
|S.No||Operator & Description|
|1||? : (Conditional )|
If Condition is true? Then value X: Otherwise value Y
<html> <body> <script> var a = 10; var b = 20; var linebreak = "<br />"; document.write ("((a > b) ? 100 : 200) => "); result = (a > b) ? 100 : 200; document.write(result); document.write(linebreak); document.write ("((a < b) ? 100 : 200) => "); result = (a < b) ? 100 : 200; document.write(result); document.write(linebreak); </script> </body> </html>
- What is a Ternary operator/conditional operator in C#?
- What is ternary operator in C#?
- What is ternary operator (? X : Y) in C++?
- Ternary Operator in C#
- Ternary Operator in Java
- Ternary Operator in Python?
- Java Ternary Operator Examples
- C/C++ Ternary Operator
- Conditional ternary operator ( ?: ) in C++
- Ternary Operator in Dart Programming
- Does Python have a ternary conditional operator?
- How Ternary operator in PowerShell Works?
- How to overload python ternary operator?