The truth is, ternaries are usually much simpler than if statements. People believe the reverse for two reasons:
Before we get into the details, let’s define a ternary expression:
A ternary expression is a conditional expression that evaluates to a value. It consists of a conditional, a truthy clause (the value to produce if the conditional evaluates to a truthy value), and a falsy clause (the value to produce if the conditional evaluates to a falsy value).