When a metal atom loses electrons it becomes a cation.Metals have low ionization energy, making it relatively easy to remove electrons from them.When a nonmetal atom gains electrons it becomes an anion. Nonmetals have high electron affinities, making it advantageous to add electrons to these atoms.The oppositely charged ions are then attracted to each other, resulting in an ionic bond.