Functions provide a way to segment repeating code snippets so you don't have to repeat the same functionality over and over.
If you are after a non-reprogrammed analogy, you can think about it in business terms:
Imagine you need to print, collate, punch, and link a document. The first time you do it yourself. Then next time you have to do it again ... and again ... So what can you do? You can hire an assistant administrator (call him Bill) to do this for you. Then, the next time you have to print, match, remove holes and bind a document, you can just tell Bill that the document is for printing (one option) and he will do it for you and return the document to you when he is done.
In this case, Bill performs a function that does some work and returns something (or at least an example of one!)
Now imagine that you want to send an email to someone to pursue a payment. Of course, you could type a letter and publish it yourself, but wouldn't it be easier if someone else did it for you? Let her call Jane. You can tell Jane which company should send the letter and how much they should (parameters), and she will leave, type it and send it. You do not need to know if she did this or not, because you trust her to do her job.
In this case, Jane is a function that returns nothing, but still does some work.
source share