Basically a layer 2 switch operates utilizing Mac addresses in it's caching table to quickly pass information from port to port. A layer 3 switch utilizes IP addresses to do the same.
3.6.2 Menus and switch Statements. One application of switch statements is in processing menus. A menu is a list of options. The user selects one of the options. The computer has to respond to each possible choice in a different way.