That's not true at all...what reaction the alkyl halide undergoes depends on factors such as the structure of the alkyl halide itself (such as sterics), the properties of the solvent, and the properties of the nucleophile (sterics/ reactivity).
Or are you asking if alkyl halides are the only things that can undergo E2?
Because as zwander stated, there are other good leaving groups that aren't halides.