Language Guide
CHAPTER 8
Handlers
232 Subroutine Definitions and Calls
If you use or or a comma instead of and with the last parameter of a with
clause, AppleScript changes the or or the comma to and during compiling.
NOTES
A subroutine call must include all the parameters specified in the subroutine
definition. There is no way to specify optional parameters.
When calling a subroutine, you can list any parameter-value pairs except
the direct parameter after the label given, not just the parameters that were
specified that way in the subroutine definition. For example, the following
two calls to the searchFiles subroutine described in the next section are
interchangeable.
searchFiles of {"March Expenses", "April Expenses"} for ¬
"Le Chateau"
searchFiles of {"March Expenses", "April Expenses"} ¬
given for:"Le Chateau"
With the exception of the direct parameter, which must directly follow the
subroutine name, labeled parameters can appear in any order. This includes
parameters listed in Given, With, and Without clauses. Furthermore, you can
include any number of Given, With, and Without clauses in a subroutine call.
Examples of Subroutines With Labeled Parameters 8
This section provides examples of subroutine definitions with labeled
parameters and of calls to those subroutines.