Summary
Your goal was to add branching logic that matches one variable or expression against many possible values.
Using the switch-case
construct, you matched an employee's numeric level with their title. You used the switch-case
as a replacement for the if-elseif-else
construct to more succinctly express your intent of converting a Stock Keeping Unit (SKU) into a long-form description.
C# developers use if
and switch
selection statements, along with conditional operators, to branch their code. The experience you've gained using selection statements enables you to choose the best C# tool for expressing your intent in your code.
Get a free verified certification
Microsoft and freeCodeCamp.org offer a training and certification combo on foundational C#. By completing this Learn module, you've already started. Explore freeCodeCamp's Foundational C# with Microsoft certification here: https://aka.ms/csharp-certification.