when barium reacts with fluorine to form an ionic compound, each metal atom loses electron(s) and each nonmetal atom gains electron(s). there must be barium atom(s) for every fluorine atom(s) in the reaction.