Salesforce Fact #119 | Ternary limitation
Suppose, we have to get the reference of an account/contact object based on a condition check. We cannot use the ternary operator for this scenario as the two return types must be compatible. So we can either cast the two object as SObjects or use the traditional if else structure to achieve the same. Attached are the screenshots.