The bonds of a compound may be covalent or ionic leading to covalent or ionic compounds.
And the kind of bonding an atom can form (with other atoms) is given by the relative electronegativity of the two atoms that form the bond.
An example is the atom Cl. It has 7 electrons in the valence shell and it can form covalent bonds or ionic bonds depending on the other element.
Cl will form ionic bonds with an atom of sodium leading to the ionic salt NaCl.
But Cl will form covalent bonds with O. For example, Cl2O3.
So, although the number of electrons may place some restrictions to the kind of bond the atoms can form it is the relative electronegativity of the tow atoms which determines the kind of bond.