global variables

hershrev hershbp at realtorsgroup.us
Wed Feb 4 19:56:43 EST 2004


On Wednesday, February 4, 2004, at 07:50 PM, hershrev wrote:

>
> On Wednesday, February 4, 2004, at 07:27 PM, Sarah Reichelt wrote:
>
>> A global works everywhere, but it has to be declared in each place 
>> where you need to use it. i.e. you must include the line "global 
>> gMyGlobalVar" in every script that needs access to the global 
>> gMyGlobalVar. If you declare it in a handler, only that handler sees 
>> it, but if you declare it outside the handler, all the handlers in 
>> that script can see it without needing a separate declaration in each 
>> handler. Even though globals are accessible everywhere, you must tell 
>> each script or handler that they are globals before you use them, 
>> otherwise they will just assume you are creating a local variable of 
>> the same name.
> That means if I declare a "global mygabc =3' out side of a scrip in a 
> stack ,when I need it in a button I have to declare it again
> "global mygabc" in the button script.
> and if I declare it in a handler in a stack ????? Where is the 
> difference ??
What I understand is that the global works every where and it has to be 
declared either in every handler , then it uses the same global ,or 
once on top of the page outside a handler. Am I  correct ?
> Thanks
>>
>> Cheers,
>> Sarah
>> sarahr at genesearch.com.au
>> http://www.troz.net/Rev/
>>
>> On 5 Feb 2004, at 10:22 am, hershrev wrote:
>>
>>> Hello, every body .
>>> What i understood from the rev Docs that a global variable put it 
>>> one stack works for the whole application without initializing it.
>>> What is the difference if put out side a handler or inside.
>>> thanks hershrev
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>>
>>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list