What is the function of the aveoli?

The function of the alveoli is to allow gas exchange with the blood and lungs. It takes in the carbon dioxide and then diffuses it.