
Concept explainers
Define the term ternary operator.

The ternary operator is a shorthand operator to represent the if else block in a simple way.
The ternary operator is used to represent the multiple line code in a single line.
The ternary operator has three operands/variables.
The ternary operator has three-part.
The ternary operator returns a value.
It is also known as the conditional operator.
The syntax of the ternary operator is:
Variable = (conditionalExpression) ? TrueExpression : FalseExpression;
Here,
The Variable is the variable to store the result return by the ternary operator.
The conditionalExpression is the condition.
The TrueExpression is the statement that executes when the conditionalExpression is true.
The FalseExpression is the statement that executes when the conditionalExpression is false.
Step by stepSolved in 3 steps with 1 images

- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





