What is the role of comic foil?

comic foil is usually a person who is the opposite of the stupid and funny character.