For one, if the function is needed multiple times, you save on code size (no repeated code) by using a function. Which would make for easier maintainability of the code.