one code twice

why use the same code twice in different places?
use the function.