• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scope for Beginners
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

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

  • Prev by Date: Re: Scope for Beginners
  • Next by Date: Re: Print word document to PDF
  • Previous by thread: Re: Scope for Beginners
  • Next by thread: A formatting issue?
  • Index(es):
    • Date
    • Thread