Sweating aids thermoregulation: mammals
The sweat glands of many mammals aid thermoregulation through evaporative cooling.
"Sweat glands play an extremely important part in temperature control. Shaped like a tube, knotted at the bottom and opening out of the epidermis at a 'pore', sweat glands secrete a colourless liquid which evaporates on the surface of the skin removing excess heat…There are two kinds of sweat glands: apocrine, associated with hairy skin, and eccrine, associated with smooth. Apocrine glands seem to be concerned mainly with producing scented secretions, and are progressively replaced in the more advanced mammals - gorillas, chimpanzees, and especially man - with eccrine glands, whose secretion dilutes and spreads that of the apocrine glands." (Foy and Oxford Scientific Films 1982:79)
Learn more about this functional adaptation.