Switch

An introduction to switch statements which are also a way to execute selective code based on specified conditions.

The case of multiple if-else statements strung together to test for different values, and execute different code, is common enough that there is a special construct called the switch statement that is provided for this case:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy