Switch statements

Learn how to execute selective instructions using switch statement.

We'll cover the following

There is an abbreviated version for a long chain of if-else statement: the switch operator. Switch is like a telephone operator. It puts you through some code in case the correct value is stored in your variable. There is also a default line, saying “the number you have dialed is invalid”.

Get hands-on with 1200+ tech skills courses.