SUB subroutineName ( param AS type, [param2 as type...] )
- subroutineName - subroutineName is the name you have given to this subroutine. This is the name that you will use when
you call the subroutine using the CALL command.
- param - param is the name and type used to reference the first argument to the subroutine.
- param2 - param2 is the name and type used to reference the second argument to the subroutine.
- … - You should continue to list any further parameters as necessary. Note that each parameter identifier must be unique.
The SUB keyword is used to define subroutines in your program. Subroutines can contain any valid statements but they
are best kept to containing a sequence of steps that implement a single tasks - A good rule of thumb is if you can assign
it a simple meaningful name then you have probably got the contents of your subroutine correct. If you find yourself
giving your subroutines names like “SUB DO_X_AND_Y_OR_Z” then you should consider breaking these down into smaller