Branch the flow of code using the switch-case construct in C#
Learn how to add branching logic that matches one variable or expression against many possible values.
Learning objectives
After you complete this module, you'll be able to:
Use the switch-case construct to match a variable or expression against several possible outcomes
Convert code that uses an if-elseif-else construct into a switch-case construct
Add
Prerequisites
Experience creating simple C# applications that include console I/O and access the methods of .NET classes such as String and Random
Experience using Visual Studio Code to develop, build, and run C# console applications that implement arrays, if-elseif-else statements, and foreach statements
Experience using C# code to evaluate conditional expressions and manage variable scope inside and outside of code blocks