Questions tagged [ternary-operator]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
31 views

How to rewrite that ternary operator code to if-else?

I can't understand that part of the code - how to rewrite this to if-s and else? Especially the partthis.map1?.containsKey(custom_object__c?.workflow_status__c) List<custom_object_2__c> ...
user avatar
  • 3
1 vote
1 answer
2k views

A special ternary condition in apex (safe navigation operator)

I've seen this somewhere, sometime before but I can't remember how it's used and I can't find anything about it online (Probably because I don't know what to search for). So please help me understand ...
user avatar
  • 620
9 votes
2 answers
1k views

Ternary Operator Compile Failure. Incompatible types in ternary operator

Assume we have some code in Apex: APEX Boolean isString = true; // or false List<String> labels = new List<String>{ 'Label' }; Object entity = isString ? labels.get(0) : ...
user avatar