The "Switch" Statement

A switch statement is a loop that is basically like a bunch of "if" statements, but it only tests one expression. The benefits of using a switch statement rather than a bunch of "if" statements are that it is much cleaner code and easier to understand.
A switch statement looks like this:
switch(expression)
{
case [Expression 1]: // do whatever
case [Expression 2]: // do whatever
}
You see in this, [Expression 1] and [Expression 2] test what the value returns. It would basically be like this in an if statement:
if (expression = [Expression 1]) // do whatever
if (expression = [Expression 2]) // do whatever
There is one other statement that you should know about. It is the break; statement. This breaks out of the loop, so stops the loop from continuing.

This may help to clarify things:
switch(expression) // gets the expression value
{
case [Expression 1]: // In case the given expression is equal to this. Do whatever
case [Expression 2]: break; // Same as above; "break" stops the loop from continuing to check any other values below this.
}