I agree with helping to keep the sun and rain out of your eyes.
But for me, with my long hair, it a major necessity riding in the mammoth on the road to keep it from bullwhipping us both into submission.
In the on the trails it helps keep some of the dust out of my hair and in the woods helps to prevent bugs, especially ticks, from getting in your hair.
But it is rude to wear a hat inside. Too many people have never been taught manners.