Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scope for Beginners



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Scope for Beginners (From: Ruth Bygrave <email@hidden>)
 >Re: Scope for Beginners (From: "Mark J. Reed" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.