Learn Create Your Own Split Screen

Next Page

You can think of it this way:

An if-statement is a two-way conditional statement. The "test" part evaluates to either true or false, no other possibilities, and either the statements in the "then" part get executed, or the statements in the "else" part get executed. No other possibilities.

A switch-statement is a multi-way conditional statement. Not just two possible outcomes, but any number of outcomes.


It doesn't let you do anything you couldn't have achieved using multiple if-else's, but it lets you achieve it more concisely, more clearly, and ultimately with less chance of error.