It’s a mechanism to protect your teeth from the acid that you’re vomiting.
Also it’s a good idea to rinse your mouth after throwing up to wash away the acid but not brush your teeth right after it, but waiting about half an hour. For the same reason you shouldn’t drink acidic liquids such as fruit juices before brushing your teeth. Otherwise you brush away the top layer of your teeth.
Latest Answers