Last active
June 21, 2018 08:13
-
-
Save ChuckJonas/f7ea82e7796fdffa455dc97f1062fbea to your computer and use it in GitHub Desktop.
Apex (Salesforce) switch statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
private static final String TARGET_VALUE = 'new'; //compile time constant | |
//... | |
Account acc = new Account(name= TARGET_VALUE); | |
switch on acc.Name { | |
when TARGET_VALUE { //ERROR: when identifier' is only allowed for switch on enum | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment