Calcium iodide (#CaI_2#) is an ionic bond, which means that electrons are transferred.
In order for #Ca# to become the ion #Ca^(2+)#, the calcium atom must lose 2 electrons. (Electrons have a negative charge, so when an atom loses 2 electrons, its ion becomes more positive.)
In order for #I# to become the ion #I^(1-)#, the iodine atom must gain 1 electron. (When an atom gains an electron, its ion will be more negative.)
However, the formula for calcium iodide is #CaI_2# - there are 2 iodine ions present. This makes sense because the iodine ion has a charge of -1, so two iodine ions have to be present to cancel out the +2 charge of the calcium ion.
Therefore, the calcium atom transfers 2 valence electrons, one to each iodine atom, to form the ionic bond.