The ternary operator is used for the evaluation of the statement. Conditional statements are shown with the help of the ternary operator.
The operator consists of true or false values along with the statement which needs to be evaluated.
The ternary operator evaluates the statement and checks for the condition, if the condition is fulfilled then the assigned value is returned and if the condition turns out to be false then the alternate value is returned.