the term is used especially in physiology, in phrases like "the function of the kidneys is to excrete urea from the body" or "the function of the heart is to push blood around the body". it is incorrect to use the word 'purpose' instead of 'function', because the word 'purpose' implies forethought.