Re: Labeled parameters -- with boolean not defined
Re: Labeled parameters -- with boolean not defined
- Subject: Re: Labeled parameters -- with boolean not defined
- From: Axel Luttgens <email@hidden>
- Date: Wed, 28 Jan 2004 14:03:23 +0100
Walter Ian Kaye wrote:
to ExploreCaves for aReason with spelunking
if spelunking then -- Error: the variable spelunking is not defined.
end if
end to
Oops, I meant 'end ExploreCaves' (I was retyping from other machine
and messed up. Please don't fire me, hehe.)
Hmm... this seems to work:
tell me to ExploreCaves for "fun" with spelunking
tell me to ExploreCaves for "fun" without spelunking
to ExploreCaves for aReason with spelunking
local spelunking
if spelunking then
display dialog "Get muddy."
else
display dialog "Stay dry."
end if
end ExploreCaves
According to the ASLG, the "correct" handler definition should be (I
just slightly augmented the display dialog statements to make clear what
is a variable and what is not):
to ExploreCaves for aReason given spelunking:aBool
if aBool then
display dialog aReason & " - Get muddy."
else
display dialog aReason & " - Stay dry."
end if
end ExploreCaves
Your above calls
ExploreCaves for "fun" with spelunking
ExploreCaves for "fun" without spelunking
should now work as expected, as they do here...
Now, it is interesting to see that your handler definition
to ExploreCaves for aReason with spelunking
nevertheless works. It is as if the interpreter converted that into:
to ExploreCaves for aReason given spelunking:spelunking
I guess variable declaration isn't always optional...
Are you sure that you really needed such a declaration (I don't need
one, here)?
Couldn't it be an artifact of successive trials?
As typing on one machine and... ;-)
HTH
Axel
_______________________________________________
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.