Creates a switch statement for a variable.