Last active
May 10, 2018 06:57
-
-
Save anilsomasundaran/d2448276cdc9e517375a7dffd74092da to your computer and use it in GitHub Desktop.
This file contains 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
String color = 'Y'; | |
//Expression should be any of the allowable type value | |
switch on color { | |
when 'V' { | |
System.debug('Violet'); | |
} | |
when 'I' { | |
System.debug('Indigo'); | |
} | |
//Multiple values given as comma seperated | |
when 'B','G' { | |
System.debug('Blue or Green'); | |
} | |
when 'Y','O','R' { | |
System.debug('Yellow or Orange or Red'); | |
} | |
when null { | |
System.debug('Bad Value'); | |
} | |
when else { | |
System.debug('Not in spectrum'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment