Questions tagged [switch]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
31 views

How to eliminate if/elseif/else chain for SObjectType variables? [duplicate]

In a few places I have code of this nature: private static void myMethod(SObjectType t) { if (t == Claim__c.SObjectType) xyzForClaims(); else if (t == Account.SObjectType) xyzForAccounts(); ...
6
votes
1answer
402 views

Switch “when” cannot see constants?

I am trying to use a switch statement with constants but it doesn't appear that the switch statement can see the constants. At the top of the class I have: private final String A_B_C = 'a b c'; ...