Re: Scope for Beginners
Re: Scope for Beginners
- Subject: Re: Scope for Beginners
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 16 Jun 2007 12:48:50 -0400
My example was meant to be conceptual, more pseudocode than anything
else, but it came out in horribly befuddled mixture of syntaxes and
didn't even get the semantics right, so let me try again:
set i to 1
repeat while i ≤ 3
someHandler()
set i to i + 1
end repeat
on someHandler()
set i to 1
repeat while i ≤ 3
display dialog "i = " & i
set i to i + 1
end repeat
end someHandler
As written, that will display "i=1", "i=2", "i=3, and then repeat and
cycle again,two more times, a total of nine dialog boxes. If you add
the line "global i" to the top of someHandler, though, it will execute
only three times and quit.
Ruth replied:
Thank you, Mark! Admirably clear and concise introduction to the
sorts of problems I have as self-taught...
Glad you found it helpful. :)
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden