Subroutines are a good way to structure your program into manageable parts. If in your program task appear several times you should no write the same code again but put it into a subroutine and call the subroutine several times. Subroutines should be written to be reusable, i.e. the code should independent from the rest of the program with the exceptions of the a parameters that enter and leave the subroutine.
/ABC/