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: Property and variable



On 11/3/06 at -0500 Mark J. Reed said this

>The fact that handlers can't see "global" variables is generally considered
>a good thing. :)

Sorry Mark,

This statement is inaccurate. If it were true this script would not work.

--> Cut <--
global a, b

set a to 3
set b to 4

display dialog my adder() as Unicode text

on adder()
	return a + b
end adder
--> Cut <--

It would be more accurate to say - variables in the top level ("on run") handler aren't visible to sub-handlers unless specifically declared as global in scope (see above script) even though they share some of the other aspects of "global" variables.

JBS
-- 
Get a new car for your spouse.  It'll be a great trade!
 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Property and variable (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.