(1) All elements and compounds (eg. CL2, SO2) have an oxidation state of 0
(2) The oxidation state of an ion is equal to its charge (so CL- is -1, MnO42- is -2)
(3) H in a compound is always +1, Na and K are +1, O is -2 etc etc
Therefore
Cl2
Cl2 is 0 because its an element.
HClO
The oxidation state of chlorine in HClO can be worked out as follows...
HClO has an overall charge of 0 because its a compound.
You can split it up into its components so...
H + Cl + O = 0
You know H is +1 and O is -2 so...
+1 + Cl + -2 = 0
Simple rearrangement will let you figure out that the Cl in HClO is +1.