Step-by-step explanation:
It is true that when a neutral atom tends to lose an electron then it forms a positively charged ion called cation. And, when a neutral atom tends to gain an electron then it forms a negatively charged ion called anion.
For example, the atomic mass of magnesium is 12 and its electronic configuration is
.
So, in order to attain noble gas configuration it will lose its 2 valence electrons. Therefore, it will form
ion.
And, atomic number of chlorine is 17 and its electronic configuration is
. To attain noble gas configuration it will readily accept an electron from a donor atom.
Hence, it will form
ion.