Here's why:
* Covalent bonds form when two non-metals share electrons. They share the electrons because they have similar electronegativity (a measure of how strongly an atom attracts electrons).
* Ionic bonds form when a metal and a non-metal transfer electrons. The metal loses electrons to become a positively charged cation, and the non-metal gains electrons to become a negatively charged anion.
Examples of covalent compounds:
* Water (H₂O)
* Carbon dioxide (CO₂)
* Methane (CH₄)
Examples of ionic compounds:
* Sodium chloride (NaCl)
* Calcium oxide (CaO)
* Magnesium sulfide (MgS)