Molecular compounds are chemical compounds that take the form of discrete molecules like water $$\left( \ce{H_2O} \right)$$ and carbon dioxide $$\left( \ce{CO_2} \right)$$. These compounds are very different from ionic compounds like sodium chloride $$\left( \ce{NaCl} \right)$$, which are formed when metal atoms lose one or more of their electrons to nonmetal atoms and the resulting ions are mutually attracted to each other.