If it is a - and -, the bond is covalent. The electrons are shared in the bond. To get the formula, you have to draw the Lewis Dot structures for the elements and connect the dots that don't have friends. You write the formula based on your drawing. To name it, use prefixes to indicate the number of atoms in the formula and the second one ends in -ide. For these it doesn't matter which element comes first.
There are 4 atoms that commonly form diatomic molecules with a covalent bond... and hydrogen is one of them! That weird atom!