Introduction
Functions help keep your script neat and easy to understand. They let you reuse code without repeating it.
When you want to run the same steps multiple times in a script.
When you want to break a big task into smaller, clear parts.
When you want to make your script easier to fix or change later.
When you want to share parts of your script with others.
When you want to test parts of your script separately.