Switch on Case status
switch on compares one value with a list of when branches and runs the first match.
Your task
Fill in routeFor so it uses switch on status to pick an action, then run the provided debug lines.
String routeFor(String status) {
String action = null;
return action;
}
Case caseRecord = new Case(Status = 'New');
System.debug('New action: ' + routeFor(caseRecord.Status));
caseRecord.Status = 'Working';
System.debug('Working action: ' + routeFor(caseRecord.Status));
caseRecord.Status = 'new';
System.debug('Lowercase action: ' + routeFor(caseRecord.Status));Requirements
switch on statusshould be presentwhen elseshould be presentNew action: Assignshould be printedWorking action: Continueshould be printedLowercase action: Reviewshould be printedrouteFor('Escalated')should beReviewrouteFor('Working')should beContinue