Ionic compounds are formed by a positive ion called cation and a negative ion called anion.
I will show you some examples:
NaCl is formed by the cation Na+ and the anion Cl -
CaF2 is formed by the cation Ca 2+ and the anion F -
Li2O if formd by the cation Li + and the anion O 2-.
To tell that you use the oxidation number of each element. I did it this way
Ca F2 => Ca has oxidation number 2+ and F has oxidation number 1- then the ions have that very same charge number.