Salesforce Fact #194 | Safe navigation in if-else condition
Do you know we can use safe navigation operator in if-else check. Suppose, we have to check whether a list is not NULL and also it is non-empty. So generally we would first check if it is NULL and then would check with the isEmpty() function.
But using safe navigation operator, we can cover both the condition check in a single expression. The results would remain the same in both the cases.
Attached are the screenshots.
Comments
Post a Comment