Is there a Halachah that forbids eating while learning? One of my friends told me it was forbidden.
Mishna B'rura 170:1 bans saying words of Torah while eating a meal, lest food go down the windpipe instead of the esophagus. I see no reason eating anything else would be different from eating a meal but, of course, contact your rabbi for practical guidance rather than relying on what you read on this site. (And in this case, if your rabbi permits it, you may wish to contact your doctor also to see if he forbids it.)
I know of no reason one couldn't eat while thinking (not speaking) words of Torah. (Of course, eating while in the process of studying Torah, especially with a study partner, even while not speaking words of Torah, will limit your ability to speak Torah words aloud if any happen to come to you while you're eating, per the preceding paragraph, and thus prevent good studying. Moreover, eating can distract you from properly thinking about what you're studying. It may therefore be inadvisable; again, ask your rabbi.)