Description: |
The assumption is: A batch script snippet can be named a function when:
- ... it has a callable entrance point.
- ... on completion execution continues right after the command that initially called the function.
- ... it works the same no matter from where it`s being called, even when it calls itself recursively.
- ... the variables used within a function do not conflict with variables outside the function.
- ... it exchanges data with the calling code strictly through input and output variables or a return code.
The benefits behind functions are:
- Keep the main script clean
- Hide complexity in reusable functions
- Test functions independently from the main script
- Add more functionality to your batch script simply by adding more functions at the bottom
- Don`t worry about the function implementation, just test it and use it
|