Switch Scope

In this lesson, you will see two ways to use the switch statement and how those ways can affect the scope of variable declaration.

A switch statement is similar to an if statement. The condition set between the two parentheses must be met to reach one of the cases. If not, the default case will be entered.

Get hands-on with 1200+ tech skills courses.