what is the difference between ternary operator and if-else statement?
Difference between Ternary Operator and If Else Ternary Operator is a programming statement. “If-Else” is a programming block. ... In the initialization of variables, the Ternary Operator can be used where as if conditions can not be used. For example, variable “max” is assigned with value either a or b based on condition.