The function of the iris is to control the amount of light entering the eye. It achieves this by adjusting the size of the pupil, thereby regulating the light that reaches the retina. This ensures optimal lighting conditions for clear vision in various environments.