Skip to content

Instantly share code, notes, and snippets.

@ChuckJonas
Last active June 21, 2018 08:13
Show Gist options
  • Save ChuckJonas/f7ea82e7796fdffa455dc97f1062fbea to your computer and use it in GitHub Desktop.
Save ChuckJonas/f7ea82e7796fdffa455dc97f1062fbea to your computer and use it in GitHub Desktop.
Apex (Salesforce) switch statement
//...
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