Subroutines can optionally have parameters associated with them, but they must complete all their work in the subroutine because they can not return any values back to the portion of the program that called them.
Sub routines start with a declaration of the name and parameters and end with a “End Sub” statement. An example subroutine would look like so:
Sub AddNumbers (x, y)
To call this subroutine from your script you would simply place the following code elsewhere in your script:
AddNumbers 2, 4
(Notice that parenthesis were not used when calling the subroutine.)]]>