How do we know which element is the anion in a chemical formula ?

Anions are the first element in a chemical formula and don't end with -ide or

Anions are the last element in a chemical formula and end with