Switch statement accepts expression (like variable or constant) and executes one of many code blocks.
case
specifies the value to check.
break
separates code blocks.
default
is used to handle cases when expression's value
doesn't match any of the cases. It's not mandatory to specify
Let's look at a program that converts number into traffic light color.
Rules are the following: