Chlorine reacts with metals to form ionic compounds. For example:
Na++Cl−→NaCl which is an ionic compound.
But when reacting with non-metals, which have electronegativity comparable to that of chlorine, ionic bonds are not possible. Instead, the compounds are mostly formed by sharing of electrons as in:
C+2Cl2→CCl4
In this, carbon atom forms one covalent bond with each of the four chlorine atoms.