A switch is a type of a conditional, similar to an If statement.
When to use
Use switches when you have lots of different cases to test against.
Switches act sort of like if statements. The general format is:
Hints & tips
- Switches are similar to If statements
- Use a switch when you have lots of cases to test against
Lesson notes are only available for subscribers.