switch case in apex code example
Example: switch statement in apex
for(Integer i=1; i<=5; i++){
Switch on i {
when 1,2{
System.debug('case 1 and 2');
}
when 5{
System.debug('case 5');
}
when else{
System.debug('case 3 and 4');
}
}
}