Labeled parameters
Labeled parameters
- Subject: Labeled parameters
- From: Steve Roy <email@hidden>
- Date: Thu, 27 Mar 2003 10:20:09 -0500
Good morning,
I have an old copy of Danny Goodman's Complete AppleScript Handbook (the first
edition from 1993!) and in the section about labeled parameters, he mentions
that the of|in label for the direct parameter is optional. However, when I try
to omit it, the script won't compile.
The following works fine.
sayHi to "Steve"
on sayHi to aUser
display dialog "Hi " & aUser & "!"
end sayHi
But none of the following does.
sayHi to "Steve"
on sayHi aUser
display dialog "Hi " & aUser & "!"
end sayHi
sayHi "Steve"
on sayHi to aUser
display dialog "Hi " & aUser & "!"
end sayHi
So the question is, is my book that old or am I not understanding this right? :)
Danny's exact words are:
"[snip] here's the formal syntax definition for a labeled parameter subroutine:
on|to subroutineName [[of|in] directParameter]... [snip]"
And then:
"While the 'of' and 'in' words are optional (and help readability), the only
other restriction about the 'directParameter' is that it must be the first
parameter about the 'subroutineName'. If you think about the 'display dialog'
command, it has a similar setup [snip]"
Steve
--
Steve Roy <email@hidden>
Personal homepage: <
http://homepage.mac.com/sroy>
Projects homepage: <
http://www.roydesign.net>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.