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: Handler query - exchanging values




Le 27 juin 2006, à 05:11, Malcolm Fitzgerald a écrit :

-------------------------------------
global apples, bananas, grapes, oranges

firstHandler()

on firstHandler()
global apples, bananas, grapes, oranges --> declares that these variables are global - not local
    set {apples,bananas} to {1,2} --> as a general rule lists are faster
my secondHandler() --> no need to pass params, they're global!
log {a:apples,b:bananas,g:grapes,o:oranges}
end firstHandler


on secondHandler() --> no params because we're using globals
global apples, bananas, grapes, oranges --> declares that these variables are global - not local
if apples is 1 then set oranges to 3
if bananas is 2 then set grapes to 4
--> no need to return data as the variables are global and will be seen outside this handler
end secondHandler
------------------------------------------------

Hello Malcolm,

Just matter of curiousity. For my own needs, I prefer to pass the needed values from one handler to an other one.

what need for the " set variables as global" in the handlers ?
I thaught that defining them as global in the main script was sufficient.
For see, I removed the two " set variables as global" instructions from the handlers and didn't sew any odd effect.
Am'I missing something ?


Yvan KOENIG
_______________________________________________
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

This email sent to email@hidden
References: 
 >Handler query - exchanging values (From: email@hidden)
 >Re: Handler query - exchanging values (From: Malcolm Fitzgerald <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.