Anonymous user
Function definition: Difference between revisions
m
→{{header|AppleScript}}
m (→{{header|Wren}}: Changed to Wren S/H) |
imported>RonReu |
||
Line 419:
end</syntaxhighlight>
A function in AppleScript is called a "handler". It can take one of three different forms, depending on what the scripter finds most convenient. Calls to it must match the form used in the handler definition
Handler names followed by zero or more parameters within parentheses are called "positional" -- the number and order of the parameters in the caller must match those in the handler definition.
<syntaxhighlight lang="applescript">on multiply(a, b)
Line 427 ⟶ 429:
multiply(2, 3)</syntaxhighlight>
AppleScript also offers handlers with "
These prepositions can be used: <code>about, above, against, apart from, around, aside from, at, below, beneath, beside, between, by, for, from, instead of, into, on, onto, out of, over, since, thru, through, and under</code>. Also, <code>of</code> is also available, but if used it must be the first parameter.
Example:
<syntaxhighlight lang="applescript">on multiplication of a by b
|