A word about hats: Gone are the days when a well dressed man wore a felt fedora in cool months and a straw boater in the summer. Hats should be removed indoors unless someone's religious customs dictate that they keep them on.
Indoors means out of the elements, whether a house, a store, or an elevator. The same applies to young boys entering school buildings (girls as well), particularly classrooms. It's appropriate for fast food workers to keep their hats on; hats of any sort on men and boys are an outdoor apparel, not indoors.
In most situations, it is thoughtful to remove one's hat and hold it for the duration of an event or performance, such as, the theatre, church, or the movies, especially the oversized hats most women wear...have some class (Emily Post's Etiquette).